Jak pracować z treecombo w Extjs 4.1
Znalazłem nauczycielahttp://www.sencha.com/forum/showthread.php?198856-Ext.ux.TreeCombo
Próbuję zrobić treecombo w Extjs4.1 whttp://jsfiddle.net/rq2ha/ oto mój kod
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
}
});
});
1. problem: Chcę uzyskać identyfikator drzewa i zrobić coś Kiedy kliknę element drzewa na combo. Ale combo nie jest kompletne (zakończone), gdy klikam (kombi nic nie rób).
2. problem: jeśli zmienię sklep jest dynamiczny jak
var treestore = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'example.php',
reader: {
type: 'json'
}
},
autoload: true
});
Dostanę błąd
mój 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}]},...
Jak mogę to naprawić?