We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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.

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>

Article ID: Published Date: Last Revised Date: Platform: Control:
4022 02/13/2015 02/13/2015 JavaScript ejmGrid
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon