Hi,
I'm trying to add a node to a tree that has loadOnDemand: true, on client-side. I can't find anything in the API that allows adding a node, and I can't seem to add it to the data source and re-bind since the data source is loaded on demand. Is there perhaps a way to modify the current set of loaded nodes?
For example, take the tree below, given that the 100/200/300 nodes are loaded initially, and then the 010/020 nodes and 001/002/003 nodes are loaded on demand when their parent is expanded. If I want to add a node "Node 004" as another child of Node 010 (it would be a sibling to nodes 001/002/003), is that possible on client-side?
Thanks,-Jared
Hi there Jared,
Currently there is no add/delete node functionality implemented internally. However you can achieve the desired functionality. You can add objects to the data source and rebind the tree. What this would do is rerender the tree with the new data and the new node would be there then.
Please let me know if this helps, or if you need additional information. I would be glad to help you further!
Hi Konstantin, thanks for your response.
Rebinding is fine, but since I'm using loadOnDemand functionality my data source is on the server side, so the igTree is downloading parts of the data each time nodes expand by making calls to the server. Does the igTree keep an accessible client-side copy of the partial data source that has been loaded thus far when expanding various nodes? If so, I could add the new node to that local data instead of the server data, and rebind the tree to that local data to avoid extra server calls. I've been unable to find something like this in the API so far, so please let me know if it is available.
Hi Konstantin,
Yes, have attached some sample code for you to look at, details below. Also, in our real application we're dealing with many more than 2k nodes in the tree if we download the entire hierarchy at once. I've actually exceeded default size limits for the JSON serializer when returning the whole tree before, so that's not really a good option. Using loadOnDemand is basically a must for us :-)
-----
Due to file size limitations I've attached only the files I edited when creating a new "ASP.NET MVC3 Web Application" project (using C# language, Razor view engine, HTML5 semantic markup, and the Intranet Application template). The 4 files attached should be:
You'll want to update the script references in Index.cshtml to point towards the right locations in your project for the ig scripts/css and jQueryUI script. You'll also want to double check the namespaces and/or usings on the cs files to make sure they match whatever you name the project. (I named mine "igTreeSample").
Let me know if you have trouble getting it working in a new project or if you find anything that will work for me.
Thanks!-Jared
Hey Jared,
You can zip your project and attach everything this way.
Thanks,
Konstantin
Unfortunately, the default MVC 3 project is too large when zipped, even without my code and the igTree code. When I tried to upload the entire project the site gave me an error specifying that 200kB was the maximum file size it would allow to upload. Will try to find some time today to host the solution online somewhere so you can access it that way.
Hi Jared,
It would be great if you could do that!
Thanks!
Just wanted to know if the above issue was resolved. If yes, could you post a sample here.
Also, can we use dynamic loading in an .aspx page using normal ASP.NET web service, or is OData service required in this case.
Thanks a lot.
Hello adogg,
This blog post will most probably be interesting to you: https://ko.infragistics.com/community/blogs/b/engineering/posts/the-infragistics-tree-with-a-context-menu
Hi adogg,
We do have plans to have such functionality in the near future. Please follow the updates on the Infragistics blogs in order to receive more information about the future releases.
Sincerely,
Do you have plans to introduce client-side tree modification functionality in the nearest future?
Thanks.
Hi there,
You are correct about the igTree not supporing adding and deleting of nodes at this point. You can use a custom service with the igTree, it is not limited to oData. I have explained the request parameters for each load on demand request in the following forum post:
http://community.infragistics.com/forums/t/65356.aspx
Thank you for using the Infragistics forums!
Issue was not resolved, I believe it is not possible with current igTree to add nodes on client side without re-binding the tree in this release. Hoping this will be included soon in a future release.
As to your other question, I'm currently able to do dynamic loading from an MVC controller action, very similar to a regular ASP.NET web service. The action returns data in JSON notation, so the tree does not appear to be limited to OData sources.