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: November 16, 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 ?

Platform: JavaScript |
Control: ejmGrid |
Published Date: February 13, 2015 |
Last Revised Date: February 13, 2015
Tags: grid, mobile

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>

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

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