Hi,
The Estado value for some parent element may be false, but if its children are true this will make the parent partially checked (because of the triState checkboxMode). I have prepared a sample that demonstrates this. Please have a look and let me know if you have any questions.
Hi again.I try to use the solution that you sent me, http://es.infragistics.com/community/forums/t/70543.aspx , but the problem continued, i implemented this:
$("#tree").igTree({
singleBranchExpand: true,
dataSource: data,
dataSourceType: "json",
checkboxMode: "triState",
pathSeparator : ".",
rendered: function (evt, ui) { TreeEstado(evt, ui) },
bindings: {
textKey: "Text",
valueKey: "Value",
childDataProperty: "Submodulos",
}, });
The TreeEstado function is:
function TreeEstado(evt, ui) { var nodes = ui.owner.uncheckedNodes(); for (var i = 0; i < nodes.length; i++) { node = nodes[i]; if (node.data.Estado == true) { $("#tree").igTree("toggleCheckstate", node.element) // toggle the checkState of each node } };}
In this function Estado is the flag that indicated whether or not an node is checked or is unchecked. Estado is a field in my datasource.
The final result in the tree is not correspond to the datasource, i explain, some nodes in the tree are with checked mark but in the datasource Estado is false and viceversa.
Thank you for you help
Hi there,
When using the toggleCheckstate API call with checkboxMode: 'triState' and lots of nodes you will experience a performance slowdown because toggleCheckstate cascades for child and parent nodes in order to adjust their checkbox state according to the newly checked node. Please refer to this forum thread in order to bypass the cascading functionality.
http://es.infragistics.com/community/forums/t/70543.aspx
My reply towards the bottom of the thread explains how to do that.
Thank you for using the Infragistics forums!
Hi, i need to use the example "1) How to make the checkbox checked while loading igTree? " my data have more that 600 nodes, but when rendered event is call with the function:
the data structure is as follows:
data:[[0 textKey: "Text", valueKey : "01", IsActive : "Yes", childDataProperty: "Submodules"]
the function is as follows:nodes = ui.owner.uncheckedNodes();$.each(nodes, function (n, node) { if (node.data.IsActive == "Yes") { $('#tree').igTree("toggleCheckstate", node.element); }})
the proccess takes about 5 minutes, how i can optimized this proccess?
To get all nodes you can perform:
// Get elements
var nodes = $("#treeId li[data-role=node]");
// If you wish to turn them into node objects
var nodeObjects = [];
nodes.each(function () {
nodeObjects.push($("#treeId").igTree("nodeFromElement", $(this)));
});