日期:2014-05-16 浏览次数:20688 次
var tree = new Ext.tree.TreePanel({
id:'tree',
height: 300,
width: 400,
useArrows:true,
autoScroll:true,
animate:true,
enableDD:true,
containerScroll: true,
rootVisible: false,
frame: true,
root: {
nodeType: 'async'
},
dataUrl: 'OutputTree',
listeners: {
'checkchange': function(node, checked){
if(checked){
node.getUI().addClass('complete');
}else{
node.getUI().removeClass('complete');
}
}
}
});
tree.getRootNode().expand(true);
var win2=new Ext.Window({
title:"选择指标",
id:'win2',
width:414,
height:375,
layout:"absolute",
tools:tools,
items:[
tree,
{
xtype:"button",
text:"确定",
x:300,
y:310,
handler:function(){
alert(Ext.getCmp('tree').root);
var str = Ext.util.JSON.encode(Ext.getCmp('tree').root);
alert(str);
}
},
{
xtype:"button",
text:"取消",
x:350,
y:310,
handler:function(){
Ext.getCmp('win2').destroy();
}
}
]
});
win2.show();
var store=Ext.getCmp('tree').getStore();
var models=store.getRange()//得到Ext.data.Model[]数组
for(i=0;i<models.length;i++)
alert(models[i].getData())
var str =Ext.util.JSON.encode(Ext.getCmp(