我找到了导师http://www.sencha.com/forum/showthread.php?198856-Ext.ux.TreeCombo http://www.sencha.com/forum/showthread.php?198856-Ext.ux.TreeCombo
我尝试在Extjs4.1中制作一个treecombohttp://jsfiddle.net/rq2ha/ http://jsfiddle.net/rq2ha/这是我的代码
Ext.onReady(function() {
Ext.create('Ext.ux.TreeCombo', {
margin:10,
width:120,
height: 10,
treeHeight: 10,
treeWidth: 240,
renderTo: 'treecombo3',
store: storeMenu,
selectChildren: false,
canSelectFolders: true
,itemTreeClick: function(view, record, item, index, e, eOpts, treeCombo)
{
var id = record.data.id;
// I want to do something here.
// But combo do nothing (not selected item or not finish) when i init itemTreeClick function
}
});
});
1st problem: I want to get id of tree and do something When i click item of tree on combo. But combo not complete (seleted) when i click (combo do nothing).
第二个问题:如果我改变商店是动态的
var treestore = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'example.php',
reader: {
type: 'json'
}
},
autoload: true
});
我会收到错误
my json
[ { id : '1' , text : 'a', iconCls: 'cls1' ,children :[{ id : '2' , text : 'b', iconCls: 'cls2' ,children :[{ id : '9' , text : 'a', iconCls: 'cls' ,children :[]},{ id : '14' , text : 'a', iconCls: 'c' ,children :[{ id : '33' , text : 'b', iconCls: 'cls' ,children :[{ id : '35' , text : 'a', iconCls: 'cls' ,children :[{ id : '36' , text : 'a', iconCls: 'cls' ,children :[]}]}]}]},{ id : '16' , text : 'd', iconCls: 'cls' ,leaf:true}]},...
我该如何解决这个问题,谢谢