c# - Kendo UI Grid paging issue in ASP.NET MVC -
in kendo ui grid, set page size attribute 3 - pagesize(3):
@(html.kendo().grid<kendo.mvc.examples.models.discount>() .name("discountgrid") .columns(c=> { c.bound(d => d.id); c.bound(d => d.category); c.bound(d => d.percentage); c.bound(d => d.merchandise); c.command(cm => { cm.edit(); cm.destroy(); }); }) .pageable() .toolbar(toolbar => toolbar.create()) .editable(editable => editable.mode(grideditmode.incell)) .datasource(datasource => datasource .ajax() .pagesize(3) .serveroperation(false) .model(model => model.id(d => d.id)) .create(update => update.action("editinginline_create", "grid")) .update(update => update.action("editinginline_update", "grid")) .destroy(update => update.action("editinginline_destroy", "grid")) ) )
after adding first 3 rows, when insert 4th record, first record disappears (as expected) - don't see option go second page (page 2) in grid footer.
why that? missing?
you have specify read action on datasource , add requestend event. can place datasource read method inside event. event type parameter on requestend event such "update","create","destroy" can used determine operation complete , reload data on grid.
@(html.kendo().grid<kendo.mvc.examples.models.discount>() .name("discountgrid") .columns(c=> { c.bound(d => d.id); c.bound(d => d.category); c.bound(d => d.percentage); c.bound(d => d.merchandise); c.command(cm => { cm.edit(); cm.destroy(); }); }) .pageable() .toolbar(toolbar => toolbar.create()) .editable(editable => editable.mode(grideditmode.incell)) .datasource(datasource => datasource .ajax() .pagesize(3) .serveroperation(false) .events(e => { e.requestend("onrequestend"); })//onrequestend javascript fxn .model(model => model.id(d => d.id)) .read(read => read.action("editinginline_read","grid")) .create(update => update.action("editinginline_create", "grid")) .update(update => update.action("editinginline_update", "grid")) .destroy(update => update.action("editinginline_destroy", "grid")) )) <script type="text/javascript"> function onrequestend(e) { if (e.type === "create" || e.type === "update" || e.type === "destroy") { e.sender.read(); } } </script>
if need further information, please read link
Comments
Post a Comment