I have basic treepanel checkbox example from Ext.js like this :
Ext.onReady(function(){
var tree = new Ext.tree.TreePanel({
renderTo:'tree-div',
title: 'My Task List',
height: 300,
width: 400,
useArrows:true,
autoScroll:true,
animate:true,
enableDD:true,
containerScroll: true,
rootVisible: false,
frame: true,
root: {
nodeType: 'async'
},
// auto create TreeLoader
dataUrl: 'check-nodes.json',
listeners: {
'checkchange': function(node, checked){
if(checked){
node.getUI().addClass('complete');
}else{
node.getUI().removeClass('complete');
}
}
},
buttons: [{
text: 'Get Completed Tasks',
handler: function(){
var msg = '', selNodes = tree.getChecked();
Ext.each(selNodes, function(node){
if(msg.length > 0){
msg += ', ';
}
msg += node.text;
});
Ext.Msg.show({
title: 'Completed Tasks',
msg: msg.length > 0 ? msg : 'None',
icon: Ext.Msg.INFO,
minWidth: 200,
buttons: Ext.Msg.OK
});
}
}]
});
tree.getRootNode().expand(true);
});
And this is for check-nodes.json:
[{
text: 'To Do',
cls: 'folder',
children: [{
text: 'Go jogging',
id: 'test',
leaf: true,
checked: false
},{
text: 'Take a nap',
leaf: true,
checked: false
},{
text: 'Climb Everest',
leaf: true,
checked: false
}]
}]
So Ext.js will try to translate those json data to html input checkbox like this:
Is there any way to change the ID of input checkbox? I tried to set the key Id at json file "id:test" but it return the html script like this: Something effected on it "ext:tree-node-id=test", all i need is to set something like this "<input class="x-tree-node-cb" type="checkbox" id="test">
" Is there any way to do this? Thank you
via Faizalprbw
No comments:
Post a Comment