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.
Unfortunately, activation email could not send to your email. Please try again.

How can I utilize the datamanager query in the grid?

Thread ID:

Created:

Updated:

Platform:

Replies:

123632 Apr 5,2016 11:18 AM Apr 7,2016 05:49 AM JavaScript 4
loading
Tags: ejGrid
Wouter
Asked On April 5, 2016 11:18 AM

I've got something like this:

var dm = ej.DataManager({ url: "http://localhost:65055/odata/ArticleApi", adaptor: new ej.ODataV4Adaptor() });
        $("#Grid").ejGrid({
            dataSource: dm
        });

But now I want tot use the query of the datamanager as a datasource for the grid to narrow the selection and expand some objects. How can I do this? The examples show how to do it in the done event of the executeQuery command, but I want it the other way around to keep the benefits of using the grid with a datasources.

Prasanna Kumar Viswanathan [Syncfusion]
Replied On April 6, 2016 05:05 AM

Hi Wouter,

Thanks for contacting Syncfusion support.

To process the data based on the query, we suggest you to use query API of ejGrid.

Please find the code example and sample:

<div id="FlatGrid">

</div>


<script type="text/javascript">

    var dm = ej.DataManager({ url: "/odata/Orders", adaptor: new ej.ODataV4Adaptor() });

    var query = ej.Query().where("EmployeeID", ej.FilterOperators.equal, 2, false);

        $("#FlatGrid").ejGrid({

            dataSource: dm,

            query : query,

            allowPaging: true,

            columns: [

                { field: "OrderID", headerText: "Order ID", isPrimaryKey: true },

                { field: "CustomerID", headerText: "Customer ID" },

                { field: "EmployeeID", headerText: "Employee ID" },

                { field: "ShipCountry", headerText: "Ship Country" },

                { field: "ShipCity", headerText: "Ship City" }

            ]

        });


</script>


Refer to the Help document for the ejQuery

http://help.syncfusion.com/js/api/ejquery

Regards,
Prasanna Kumar N.S.V


Prasanna Kumar Viswanathan [Syncfusion]
Replied On April 6, 2016 05:17 AM

Hi Wouter,

Please ignore the previous update.

To process the data based on the query, we suggest you to use query API of ejGrid.

Please find the code example and sample:

<div id="FlatGrid">

</div>


<script type="text/javascript">

    var dm = ej.DataManager({ url: "/odata/Orders", adaptor: new ej.ODataV4Adaptor() });

    var query = ej.Query().where("EmployeeID", ej.FilterOperators.equal, 2, false);

        $("#FlatGrid").ejGrid({

            dataSource: dm,

            query : query,

            allowPaging: true,

            columns: [

                { field: "OrderID", headerText: "Order ID", isPrimaryKey: true },

                { field: "CustomerID", headerText: "Customer ID" },

                { field: "EmployeeID", headerText: "Employee ID" },

                { field: "ShipCountry", headerText: "Ship Country" },

                { field: "ShipCity", headerText: "Ship City" }

            ]

        });


</script>


Sample: http://www.syncfusion.com/downloads/support/forum/123632/ze/EJGrid949924602

Refer to the Help document for the ejQuery

http://help.syncfusion.com/js/api/ejquery

Regards,
Prasanna Kumar N.S.V

Wouter
Replied On April 6, 2016 05:20 AM

Thanks! Scrolled that page from top to bottom but missed it. So much options...

Prasanna Kumar Viswanathan [Syncfusion]
Replied On April 7, 2016 05:49 AM

Hi Wouter,

We are happy to hear that your issue has been resolved.

Please let us know if you need any further assistance.

Regards,
Prasanna Kumar N.S.V

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.

;