简体   繁体   English

Kendo UI MVVM网格刷新/重新加载

[英]Kendo UI MVVM Grid Refresh/Reload

These solutions ( Reloading/refreshing Kendo Grid ) 这些解决方案( 重新加载/刷新Kendo网格

    $('#GridName').data('kendoGrid').dataSource.read();
    $('#GridName').data('kendoGrid').refresh();

do not work for a Kendo MVVM grid. 对于Kendo MVVM网格不起作用。 Specifically $('#GridName').data('kendoGrid') returns 'undefined'. 具体来说$('#GridName')。data('kendoGrid')返回'undefined'。

My question is: what method could be used to trigger a grid refresh/reload via a button controller in Kendo UI MVVM grid? 我的问题是:可以使用哪种方法通过Kendo UI MVVM网格中的按钮控制器来触发网格刷新/重新加载?

Here's a solution for MVVM that allows you to refresh the dataSource of the Kendo grid. 这是MVVM的解决方案,可让您刷新Kendo网格的dataSource。 If it's the only grid on the page, the solution works fine: 如果它是页面上的唯一网格,则该解决方案可以正常工作:

$("div[data-role='grid']").data("kendoGrid").dataSource.read();

Here is an example fiddle 这是一个小提琴的例子

$('#id').data('kendoGrid') return 'undefined' when grid is not initialized. 当未初始化网格时,$('#id')。data('kendoGrid')返回'undefined'。 If $('#id') is not empty and grid is visible on page data can't be undefined . 如果$('#id')不为空并且网格在页面上可见,则undefined data You should check your jquery selector or init grid if it not visible at page. 您应该检查您的jquery选择器或init网格(如果它在页面上不可见)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM