I am using a treePanel
in which one column is using widgetColumn
with combo inside cell.
Below is sample code.
{
text: 'TC',
dataIndex: 'scrTC',
xtype: 'widgetcolumn',
widget: {
xtype: 'combo',
store: 'TCStore',
valueField: 'value',
displayField: 'displayValue',
matchFieldWidth: false,
}
}
When I change values of combo for few rows & then expand the other children in grid all combo value a reset to default value again.Not sure whats the issue here.
Code for store :
Ext.define('TC', {
extend: 'Ext.data.Store',
storeId: 'TCStore',
model: 'CommonModel',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'resources/data/tree/TC.json'
}
});
Screenshot of treepanel:
When I click on another children node, example 3 or 4 it resets the value for all combo in all rows.
Thanks for help.
Code changes after the below answer, which gives the getRecord undefined error.
Ext.define('MyTree', {
extend: 'Ext.tree.Panel',
reference: 'myTree',
columns: {
item:[{
text: 'TC',
dataIndex: 'scrTC',
xtype: 'widgetcolumn',
widget: {
xtype: 'combo',
store: 'TCStore',
valueField: 'value',
displayField: 'displayValue',
matchFieldWidth: false,
listeners: {
change: function (combo) {
if (combo.hasFocus) {
var treeview = combo.up('myTree'), //myTree is reference of my treepanel
record = treeview.getRecord(combo.el.up('tr')); ///getting error here
record.set('scrTC', combo.getValue());
}
}
}
}
}]
}
});
I have found solution,
select: function (combobox, record) {
combobox.getWidgetRecord().set(combobox.getWidgetColumn().dataIndex, record.data.value);
}
this resolves my issue.