PDA

View Full Version : Get selected tree with true in checkbox



chuvinha
21 Oct 2010, 9:07 AM
Hi guys, Iam not able to get the nodes from tree that the user selected with checkbox.
Here is my code:




<body>
<script language="javascript" type="text/javascript">
Ext.onReady(function(){
var Tree = Ext.tree;

var treeGruposLoader = new Ext.tree.TreeLoader({
dataUrl:'arvoreatributos.action'

});

tree = new Tree.TreePanel({
el:'divEmployees',
useArrows:true,
autoScroll:true,
animate:true,
loader: treeGruposLoader,
enableDD:false,
containerScroll: true,


root: {
nodeType : 'async',
text : 'Employees',
visible : false,
id : 'source'
}
});

// render the tree and expand the parent node
tree.render();
tree.getRootNode().expand();

});
</script>
<div id="divEmployees" style="width: 350px; height: 600px"></div>

<div id="fi-form"></div>
</body>
</html>




I build the tree through the json object.




{ 'id':"61",
'text':'EDUCACAO',
'checked':false,
'leaf':true
},






[LEFT]Could someone help me?

Condor
21 Oct 2010, 9:35 AM
Are you looking for:

var checked = [];
tree.getRootNode().cascade(function(node){
if (node.getUI().isChecked()) {
checked.push(node);
}
});

chuvinha
21 Oct 2010, 10:48 AM
Cool Condor.
It was work here.
Thank's very much =))