How to set the data source for the Grid Control ?
Grid’s data source can be referred from the locally stored data source. Data for the Grid is stored in local database window.gridData. You can refer to the following code examples.
[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> |
Create a div element to initialize the Grid control as in the following code example.
[HTML] <div id="mobgridfilter"></div>
Locally stored values from the window.gridData can be passed as a data source to the Grid on initialization. You can refer to the following code example.
[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> |