| [Tree] ????2014-03-12 10:41:04by ??? 在某些情况下我们需要对tree节点进行选择,这个可以通过设置showCheckBox="true" showCheckBox="true" 树节点会对应的显示一个选择框 <a:tree id="menu1" showCheckBox="true" width="220" height="350" bindTarget="demo_ds" displayField="name" idField="id" parentField="parent"/> 接下来我们通过定义一个函数来显示选中的节点数据
function showSelectNode(){
var ds = $('demo_ds'),all = ds.getAll(),sall = [];
for(var i=0;i<all.length;i++){
if(all[i].data.checked == 'Y')
sall.push(all[i].data.name);
}
alert(sall.join(','))
}
当选中一个节点后,那么对应的record中的checked值会被设置成Y,通过判断这个值可以确定某个节点是否被选中。 注意: 当某个节点被选中后,那么他的父节点的checked值也是Y Demo Attachments |
Comments
0 Responses to the article暂时没有评论。