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");
$(treecontrol).ejTreeView({
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) {
alert();
},
loadError: function (args) {
alert();
}
});
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
Sven