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. Image for the cookie policy date

handling queries with loadOnDemand

dear sir or madam,

in my project i want to place a treeview with loadOnDemand = true like this:

        var dm = ej.DataManager({ url: "/WebServices/wcf/TreeViewODataService.svc" });

        var query = new ej.Query().from("Products");

        var treecontrol = $("#tree");


            showCheckbox: true,

            loadOnDemand: true,

            width: 400,

            height: 500,

            fields: {

                dataSource: dm,

                query: query,

                hasChild: "HasChildren",

                expanded: "Expanded",

                id: "ID",

                parentId: "ParentId",

                text: "Name"


            loadSuccess: function (args) {



            loadError: function (args) {




On first load the underlying OData webservice is called with an empty oData query. When i want to expand a node, the query string is something like "ParentId='...'". The new nodes are added to the tree as I would expect it. When I now want to expand one of the newly added nodes the query String, that is passed to my OData Service looks like: "ParentId=%27...%27%20and%20ParentId..."

As you can imagine, no element in my hierarchy wil fit this condition, as every element has only got exactly one parent id. 

I know can manipulate the query string in my Service function, such that it will return the expected elements, but the treeview won't show them. Instead of showing these child elements the node remains in waiting state. Note, that no Javascript exception is thrown in my browser.

Second question:

As I use a dynamic hierarchy, I do not know in advance, if a node has children or not. If I want to expand a node with no children, the node also remains in waiting state.

Please, can you provide me a solution for these problems? 

Best regards


1 Reply

SJ Saravanan Janakiraman Syncfusion Team November 19, 2015 10:33 AM UTC

Hi Sven,

Thanks for contacting Syncfusion support.

We are able to reproduce the reported issue (“The two pids are returned on the second level of data retrieval process”), we have confirmed this as a defect and logged an issue report for this. Please log on to our support website to check for further updates.

Link: https://www.syncfusion.com/account/login

Please let us know if you have further queries.


Saravanan A J

Live Chat Icon For mobile
Up arrow icon