Made changes similar to ComboBox sources. Still shows an error [E] Layout run failed error then you open tree but at list list height does not limited by fixed value
Code:
Ext.define("Ext.ux.form.field.TreeComboBox", { extend : "Ext.form.field.Picker",
alias: 'widget.treecombobox',
requires : [
'Ext.data.TreeStore',
'Ext.tree.Panel'
],
mixins: {
bindable: 'Ext.util.Bindable'
},
config: {
store: null,
displayField: 'text',
useArrow: false
},
initComponent : function() {
var self = this;
Ext.apply(self, {
fieldLabel : self.fieldLabel,
labelWidth : self.labelWidth
});
self.addEvents('groupSelected');
self.callParent();
this.bindStore(this.getStore());
this.getStore().load();
},
createPicker: function() {
var me = this,
picker,
pickerCfg = Ext.apply({
xtype: 'treepanel',
displayField: this.getDisplayField(),
autoScroll : true,
floating : true,
focusOnToFront : false,
shadow : true,
ownerCt : this.ownerCt,
useArrows : this.getUseArrow(),
store : this.getStore(),
frame: true,
rootVisible : false,
listeners: {
'checkchange': function(node, checked) {
node.cascadeBy(function(n) {
n.set('checked', checked);
});
this.updateTextfield();
},
scope: this
}
}, me.listConfig, me.defaultListConfig);
picker = me.picker = Ext.widget(pickerCfg);
picker.on('beforehide', this.updateTextfield, this);
return picker;
},
updateTextfield: function() {
var names = [];
this.getStore().getRootNode().cascadeBy(function(node) {
if(node.get('checked')){
names.push(node.get(this.getDisplayField()));
}
}, this);
this.setValue(names.join(', '));
},
getStoreListeners: function() {
return {
load: this.onStoreLoad
};
},
onStoreLoad: function() {
this.updateTextfield();
}
});