I have a widget with combobox
& flow I need is something like this,
At first combo is disabled.
Each row has edit icon & when I click on edit only that particular combo should be enabled.
Then when I save the record the enabled combo should be disabled again.
Step 3 is not working for me.
{
text: 'TC',
dataIndex: 'scrTC',
xtype: 'widgetcolumn',
widget: {
xtype: 'combo',
store: 'TCStore',
valueField: 'value',
displayField: 'displayValue',
matchFieldWidth: false,
bind: {
readOnly: {
isReadOnly
}
}
}
}
I have also tried onwidgetattach
method, but after save this method is not called so its not working.
onWidgetAttach: function(column, widget, record) {
if (condition) {
widget.setReadOnly(false);
} else {
widget.setReadOnly(true);
}
}
Anyone has an idea?
Edit 2:
I have inserted readOnly:true to my leaf records dynamically.
In View Model create a isReadOnly function,
Ext.define('MainViewModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.main',
data: {
isReadOnly: function (record) {
return record.get('readOnly');
}
}
});
And in treeGrid its,
{
text: 'TC',
dataIndex: 'scrTC',
xtype: 'widgetcolumn',
widget: {
xtype: 'combo',
store: 'TCStore',
valueField: 'value',
displayField: 'displayValue',
matchFieldWidth: false,
bind: {
readOnly: '{isReadOnly}'
}
}
}
On first load combobox is readOnly as expected, but when i click on edit button in row it creates a new row below & i have set readOnly=false. But still the combobox is not binding as readOnly false n making it editable.