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 }
Here's a picture of the problem (see attachment).
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.
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?