Hi,
I am using IgTree Ignite UI control with knockout bindings but the tree view is not getting updated when I changed my view model.
In the given code base on click of tree ("Baby 2013" node) node event I am trying to add new JSON subgroup object to the subgroups array of the corresponding node JSON object, its getting added to the array but not reflecting the changes of the array in the tree view so I am not able to see the newly added subgroup value in the tree hierarchy.
Is there any issue with tree view or Knockout library?
Regards,
Praveen
Hello Praveen,
Thank you for contacting Infragistics!
I am looking into the details of the case. I will get back to you with more information as the week progresses. If you have any questions, please let me know as well.
Hi Vivian,
We need quick information on this problem since we need to decide the approach, as we thought of using knockout will reduces lot of developers effort to update UI elements as soon as the view model gets updated.
Hi there,
This is an interesting side-effect of knockout.js providing binding between DOM and model. In this case the push to the viewmodel is not reflected in the KO binding of the tree because the node the collection the data is inserted in is initially empty. This means that the tree does not render a child UL element for that node and there is no binding between the DOM and the data. There is a very easy way to make this work however. If the data is inserted through the tree and not through the viewmodel, then the DOM is rendered by the tree, the data is inserted in the viewmodel and everything is updated. Also all DOM bindings are created.
In general to make the solution more generic in any case where there is an empty data collection, the data member should first be inserted to the tree, afterwards it can be inserted both in the tree and in the viewmodel directly because the DOM node holding the KO binding exists.
Let me know if this is not the issue that you're experiencing.