PDA

View Full Version : Tree with checkbox



chuvinha
13 Oct 2010, 11:20 AM
Hi guys, I need to put a checkbox on nodes of my tree.
I found nothing about this.
I am using treeLoader.
Would someone have an example?

Condor
13 Oct 2010, 11:25 AM
Simply adding checked:false or true to the node attributes is enough.

chuvinha
13 Oct 2010, 11:30 AM
Is that I am not using treeNode.
Would have some form to make with treePanel or treeLoader?

Condor
13 Oct 2010, 11:58 AM
So you don't want to specify checking in your node attributes?

How about specifying baseAttrs:{checked:false} in the treeloader config?

chuvinha
13 Oct 2010, 12:32 PM
Sorry Cordon, I didn't understand what you said.
Did you say for I use baseAttrs="{checked:false}"?
I tried to use it now and It wasn't work.

Condor
13 Oct 2010, 10:40 PM
No, no quotes, e.g.

var tree = new Ext.tree.TreePanel({
...
loader: new Ext.tree.TreeLoader({
url: '...',
baseAttrs: {checked: false},
preloadChildren: true
})
});

chuvinha
14 Oct 2010, 6:56 AM
It was work here Condor.
But it appears checkbox on folders.
I need to appear checkbox only on files.
Do you know how do it?

Condor
15 Oct 2010, 4:03 AM
loader: Ext.tree.TreeLoader({
url: '...',
createNode: function(attr){
if (attr.leaf) {
attr.checked = false;
}
this.constructor.prototype.createNode.call(this, attr);
}
})