1.Grid页面某个字段修改赋值(不用刷新)
var row = GG.data("kendoGrid").select(); var data = GG.data("kendoGrid").dataItem(row); data.set("IP", "1212");
2.Grid刷新
var grid = $("#SearchGrid").data("kendoGrid"); grid.refresh();
重新读取数据库写法:
var grid = $("#VipListShow").data("kendoGrid"); grid.dataSource.read();
3.Grid赋值
var grid = $("#SearchGrid").data("kendoGrid"); for (var i = 0; i < data.length; i++) { grid.dataSource.add({ ID: data[i].ID, F_ControllerSN: data[i].F_ControllerSN, IP: data[i].IP, Mask: data[i].Mask, Gateway: data[i].Gateway, MAC: data[i].MAC, MyIP: data[i].MyIP, Remarks: data[i].Remarks, }); }
在指定索引位置插入
grid.dataSource.insert(0, { 监控记录: event.data });
4.Grid清屏
function Qing() { var grid = $("#SearchGrid").data("kendoGrid"); var All = grid.dataSource.view(); for (var i = 0; i < All.length; i++) { grid.dataSource.remove(All[i]); } }