Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dojo Enhanced Grid with JSONREST issues

I'm trying to use a enhanced grid with Dojo JSONREST and i'm running into some issues. I've been looking up some examples but can't figure out how to do what i need.

In the code below my rest service takes two parameters, and the query on the service works. The problem is that when grid.startup() is called it seems to call the Rest service again, since there are no parameters passed the rest service falls over. What am i doing wrong here?

Also is there any way to update to the store so that is only contains the queried results?, so that when the grid appears it just contains these values?

Appreciate any help or pointers..

ready(function(){

  var grid;

  var store = new JsonRest({
              target: "rest/search"
              });   

  store.query({term: "test", category: "category"},
      {
        start: 10,
        count: 10,
      }).then(function(data){

      // how do i update store with queried results?

      });

  dataStore = new ObjectStore({ objectStore: store });

  /*set up layout*/
  var layout = [[
   {'name': 'Name', 'field': 'col1', noresize: true, 'width': '100%'},
  ]];

  /*create a new grid:*/
  grid = new EnhancedGrid({
      id: 'grid',
      store: dataStore,
      structure: layout,
      selectable: true,
      selector: false,
      selectionMode: 'none',
      escapeHTMLInData: false,
      autoHeight:true
  }, document.createElement('div'));

grid.startup();
}
like image 477
blu10 Avatar asked Nov 24 '22 10:11

blu10


1 Answers

Have you tried setting the query parameter of the grid? A link to the docs. And a link to an example.

And by looking at the code in the question, it seems that the grid should display chunks/pages of data - an example using the pagination plugin for the grid.

The filter plugin might also be of interest to you.

like image 82
undefined Avatar answered Nov 26 '22 00:11

undefined