Basically, it doesn't matter which nodes I checked, every node in the checkedNodes array has the data corresponding to the first item in the data hierarchy. So if I've had the following tree data:
Grandparent - Parent - Child - Child
Then the data() of Parent and both Child nodes will be the data for the Grandparent node.
I am binding the tree data using knockout JS. I am using version 13.1.20131.2143, same issues occurs in Firefox, IE and Chrome.
This is my tree:
<div id="selectorTree" data-bind="igTree: { dataSource: tree, width: '100%', initialExpandDepth: 999, checkboxMode: 'triState', bindings: { textKey: 'text', valueKey: 'value', primaryKey: 'id', imageUrlKey: 'imageUrl', childDataProperty: 'children' } }"> </div>
This is my model:
function Model() { var self = this; self.recipeTree = ko.observableArray([]);}
These are the items I add to the tree:
function TreeNode(id, value, text) { var self = this; self.id = ko.observable(id); self.value = ko.observable(value); self.text = ko.observable(text); self.imageUrl = ko.computed(function () { return getNodeImageUrl(self.value()); }); self.children = ko.observableArray([]);}
So when I want to get the values of my checked nodes
var checkedNodes = $("#selectorTree").igTree("checkedNodes");
The Id is always 1 and the value is always the same as the top level node:
for (var i = 0; i < checkedNodes.length; i++) { var node = checkedNodes[i]; var id = node.data.id(); // Never changes var text = node.data.text(); // Never changes }
Hello will_telford,
Thank you for the update. I have logged this in our internal system with an id of TFS: 150741. I have also created a private case for this matter where you will be updated with the progress of this matter in the future.
Thanks that works. Can you please post back here when the bug is fixed?
Hi there,
The issue is appearing because you're assigning a primaryKey. If you remove the primary key and assign it as a node value for example then everything would work as expected. The thing with the primaryKey is an issue with the control and it would be fixed, meanwhile if you don't really need it you can remove it or you can use it as node value if you need it.
Another possible solution is to make the primaryKey non-observable. Then you can use it and it wouldn't affect the igTree's functionality. Anyways the primary key should most probably be read-only.
Thank you for using the Infragistics forums!
Thank you for the update and your patience. I have run your sample and I have been able to reproduce this issue. I am currently looking further into this matter to see why this behavior is occurring. As the way you are using knockout is different I am starting there to see if something in that is causing the issue. I will continue to look into this matter and will give you a progress update by the end of the day Monday.
Is there any update on this?