jquery - How to manually set the page and total results on first load of Kendo UI Grid attached to a remote dataSource (autoBind:false)? -


a similiar question posted on forum here, no answer.
demonstration of problem can seen in fiddle here. notice page 0 , says "no items display" total pages.

for progressive enhancement reasons,
grid loaded existing html table. seo , true advantage of progressive enhancement. however, want kendo grid use ajax reload it's data (for such operations sorting, pagination, etc). on initialization set datasource have remote read url. works great, 1 problem: runs unnecessary ajax call on first load. remember, generated first set of data reading existing html table...

to avoid unnecessary first ajax call, added autobind:false grid initialization. side-effect grid incorrectly says page 0 , total number of pages shows no items display.

what autobind if can't setup these elements on first load programmatically? any ideas on how can suppress first ajax call, , manually set page number , total pages myself on first load?

$("#grid").kendogrid({      sortable: true,      pageable: true,      resizable: true,      selectable: "multiple",      autobind: false,      datasource: {         transport: {             read: {                     type: "get",                     datatype: "json",                     url: "some url here",             }         },         pagesize:40,         serverpaging: true,         serversorting: true,         schema: {                     data: "rows",                    total: function(data){                                return data.total;                           }                 }       }      columns: [{                     field: "id",                              title: "id",                     width:3,                  },{                     field: "name",                        title: "name",                               width:13,                  },{ ... 

the total function defined in schema says have field in returned json name total. true? json should like:

{     rows : [         { id: 1, name: "name1" },         { id: 2, name: "name2" },         { id: 3, name: "name3" },         { id: 4, name: "name4" }     ],     total : 4 } 

is json looks like?

if not returning json field called total, should define as:

total, function (data) {     return data.length; } 

for going specific page in grid , since using autobind: false, should use:

grid.datasource.query({ page: 3, pagesize: 40 }); 

check running here : http://jsfiddle.net/wnk6d/ see grid not loaded (autobind equals false) , whenever change numerictextbox field, loads page want (not first) , nothing happens until change numeric text box.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -