[Script]
<script>
// the datasource "window.gridData" is defined for grid
window.gridData = [
{ "OrderID": 10001, "CustomerID": 101, "Freight": "Chicago" },
{ "OrderID": 10002, "CustomerID": 102, "Freight": "San Francisco" },
{ "OrderID": 10003, "CustomerID": 103, "Freight": "New York" },
]
</script>
创建初始化网格控件,如下图代码实例中的div元素:
来自window.gridData的本地存储数据可以通过网格数据源的初始化来实现,你可以参考下面的代码实例:
[Script]
<script>
$(function () {
$("#mobgridfilter").ejmGrid({
dataSource: window.gridData, //Datasource referred here
columns: [
{ field: "OrderID", headerText: "Order ID" },
{ field: "CustomerID", headerText: "Customer ID" },
{ field: "Freight", headerText: "Freight" }
],
actionComplete: function () { $("#samplescroll").ejmScrollPanel("refresh"); }
});
});
</script>
本文介绍如何将数据源绑定到essential grid for JavaScript的网格控件上。通过示例代码展示了如何定义数据源,并在初始化网格控件时引用该数据源,同时列出了包含'Order ID','Customer ID'和'Freight'字段的列配置。

被折叠的 条评论
为什么被折叠?



