ExtJs4.0中tree点击获取该节点的id或者text,求助
varstore=Ext.create('Ext.data.TreeStore',{root:{expanded:true,text:"",user:"",status:...
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
text: "",
user: "",
status: "",
children: [
{ text: "detention", leaf: true },
{ text: "homework", expanded: true,
children: [
{ text: "book report", leaf: true,id: "37000" },
{ text: "alegrbra", leaf: true,id: "37000" }
]
},
{ text: "buy lottery tickets", leaf: true }
]
}
});
var tree = Ext.create('Ext.tree.Panel', {
store: store,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop'
}
},
border: 0,
height: 500,
rootVisible: false //默认不显示根节点
});
tree.on('itemclick', function(node, event) {
Ext.Msg.alert('信息提示', tree.getRootNode().id);
});
ExtJs4.0中点击获取该节点的id,这个地方id应该是弹出"37000",可为什么一直是"Ext.data.Store.ImplicitModel-ext-gen1007-ext-record-1" 呢 求助!!!!!!!!!!!!!!!!! 展开
root: {
expanded: true,
text: "",
user: "",
status: "",
children: [
{ text: "detention", leaf: true },
{ text: "homework", expanded: true,
children: [
{ text: "book report", leaf: true,id: "37000" },
{ text: "alegrbra", leaf: true,id: "37000" }
]
},
{ text: "buy lottery tickets", leaf: true }
]
}
});
var tree = Ext.create('Ext.tree.Panel', {
store: store,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop'
}
},
border: 0,
height: 500,
rootVisible: false //默认不显示根节点
});
tree.on('itemclick', function(node, event) {
Ext.Msg.alert('信息提示', tree.getRootNode().id);
});
ExtJs4.0中点击获取该节点的id,这个地方id应该是弹出"37000",可为什么一直是"Ext.data.Store.ImplicitModel-ext-gen1007-ext-record-1" 呢 求助!!!!!!!!!!!!!!!!! 展开
3个回答
展开全部
tree.getRootNode().id ,你拿是的根结点吧? 而且子结点的 ID 都是37000,EXTJS不允许ID相同的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Ext.tree.TreePanel.getSelectionModel().getSelectedNode();
追问
错误: 对象不支持此属性或方法
追答
var tree = Ext.create('Ext.tree.Panel', {
id:'tree',//设置tree id
store: store,
viewConfig: {
plugins: {
ptype: 'treeviewdragdrop'
}
},
border: 0,
height: 500,
rootVisible: false //默认不显示根节点
});
Ext.getCmp('tree').getSelectionModel().getSelectedNode();
试试
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询