combobox - How to work with treecombo in Extjs 4.1 -


i found tutor in http://www.sencha.com/forum/showthread.php?198856-ext.ux.treecombo
try make treecombo in extjs4.1 in http://jsfiddle.net/rq2ha/ here 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;                 // want here.                  // combo nothing (not selected item or not finish) when init itemtreeclick function             }         }); }); 

1st problem: want id of tree , when click item of tree on combo. combo not complete (seleted) when click (combo nothing). enter image description here

2nd problem: if change store dynamic like

var treestore = ext.create('ext.data.treestore', {         proxy: {             type: 'ajax',             url: 'example.php',             reader: {                 type: 'json'             }         },         autoload: true     }); 

i error

enter image description here

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}]},... 


how can fix thank

to solve second problem, need specify root node when creating tree store.

var treestore = ext.create('ext.data.treestore', {         root: {             text: 'root',             id: '0'         },         proxy: {             type: 'ajax',             url: 'example.php',             reader: {                 type: 'json'             }         },         autoload: true     }); 

also, should mention variable name used tree store in jsfiddle example storemenu rather treestore. if want replace static tree store ajax version, make sure using correct variable name.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -