How to refresh the Kendo UI grid -


i trying refresh kendo ui grid have not yet been successful. please advise missed or did wrong?

i have following code:

.cshtml:

 $('#btnrefresh').click(function (e){              $.ajax({                 type: 'post',                 url: "@(url.content("~/administration/refreshall/"))",                  success: function () {                     $("#product").data("kendogrid").datasource.read();                     $('#product').data('kendogrid').refresh();                     //grid.refresh();                     location.reload(true);                 },                 error: function (){                     $("#btnrefresh").removeattr('disabled');                 }             });         }); 

controller:

public actionresult refreshall([datasourcerequest] datasourcerequest request)         {             db.processall();             response.cache.setcacheability(httpcacheability.nocache);             return view();         } 

your script should

$('#btnrefresh').click(function (e){         var grid = $("#product").data("kendogrid");                grid.datasource.page(1);                grid.datasource.read();       }); 

in controller add references

  • using kendo.mvc.ui;
  • using kendo.mvc.extensions;

your actionresult should be

public actionresult refreshall([datasourcerequest] datasourcerequest request)         {             //assuming db.processall() return list object             return json(db.processall().todatasourceresult(request));         } 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -