So arbeiten Sie mit treecombo in Extjs 4.1
Ich fand Nachhilfelehrer inhttp://www.sencha.com/forum/showthread.php?198856-Ext.ux.TreeCombo
Ich versuche in Extjs4.1 in einen Treecombo zu machenhttp://jsfiddle.net/rq2ha/ Hier ist mein Code
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: Ich möchte die ID des Baums erhalten und etwas tun, wenn ich auf das Element des Baums in der Combo klicke. Aber die Combo ist nicht vollständig (ausgewählt), wenn ich auf (keine Combo-Aktion) klicke.
2. Problem: wenn ich den Speicher ändere, ist dynamisch wie
var treestore = Ext.create('Ext.data.TreeStore', {
proxy: {
type: 'ajax',
url: 'example.php',
reader: {
type: 'json'
}
},
autoload: true
});
Ich werde einen Fehler bekommen
mein 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}]},...
Wie kann ich das beheben, danke