我正在使用treePanel
其中一列widgetColumn
与单元格内的组合一起使用。
下面是示例代码。
{
text: 'TC',
dataIndex: 'scrTC',
xtype: 'widgetcolumn',
widget: {
xtype: 'combo',
store: 'TCStore',
valueField: 'value',
displayField: 'displayValue',
matchFieldWidth: false,
}
}
当我更改几行的组合值然后在网格中展开其他子项时,所有组合值都会再次重置为默认值。不确定这里有什么问题。
商店代码:
Ext.define('TC', {
extend: 'Ext.data.Store',
storeId: 'TCStore',
model: 'CommonModel',
autoLoad: true,
proxy: {
type: 'ajax',
url: 'resources/data/tree/TC.json'
}
});
树形面板截图:
当我单击另一个子节点时,例如 3 或 4,它会重置所有行中所有组合的值。
感谢帮助。
在下面的答案之后代码发生了变化,这给出了 getRecord 未定义的错误。
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());
}
}
}
}
}]
}
});