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 your patience. I have done some looking into this matter and have created a sample to attempt to reproduce this issue. I have been unable to reproduce this issue. I am attaching my sample please test it to see what behavior you see. I check the value of the nodes on selection of a node. To create the sample I used Ignite UI 2013 Volume 1 with service release 2143. What version are you using? Do you have an isolated sample that reproduces this issue?
Hi Mike, thanks for getting back to me. As I said in my original post, I am using 13.1.20131.2143. I have adapted your attached sample and have reproduce the error. Please open the solution, click a few nodes and then click the button. You will see that no matter which nodes are clicked, the data will all be the same.
Hopefully I'm doing something wrong, but this is really causing us problems at the moment. It'd be great if you could get back to me as soon as possible. Thanks.
Here's a picture of the problem (see attachment).
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?