Hi
If I have two columns of type dropdown, is it possible to clear and set the value of a dropdown selection from a listener of the other dropdown?
Thanks
Ben
Support Forum
Hello.
What is a dropdwn column? Column with dropdown/combobox as editor? Assuming so, if you have two columns which read value from the record field then you only need to change corresponding value on the record in order to combo to pick it up.
What is a dropdwn column? Column with dropdown/combobox as editor? Assuming so, if you have two columns which read value from the record field then you only need to change corresponding value on the record in order to combo to pick it up.
columns: [
{ field : 'a', editor : { type : 'combobox' } },
{ field : 'b', editor : { type : 'combobox' } }
]
grid.on({
finishCellEdit : ({ editorContext }) => {
if (editorContext.column.field === 'a') {
editorContext.record.b = ... // this will change cell value and editor will pick it up
}
}
})
Ah right...
So in my case I have two dropdown columns:
and I want to access the currently set dropdown option of the role field dropdown from the team field dropdown focusin listener:
But, teamCombo.record is undefined.. Why is this? I am expecting the teamCombo.record to give me access to all the other record field values for the selected grid row in the teamComboFocusInHandler...
Can this be done?
Thanks
Ben
So in my case I have two dropdown columns:
{
field: 'role',
text: 'Role',
editor: {
type: 'dropdown',
store: this.roleComboStore,
clearable: true,
listeners: {
focusin: this.roleComboFocusInHandler,
change: this.roleComboChangeHandler
}
},
renderer: this.roleRenderer,
draggable: false,
width: 150,
locked: true
},
{
field: 'team',
text: 'Team',
editor: {
type: 'dropdown',
store: this.teamComboStore,
clearable: true,
listeners: {
focusin: this.teamComboFocusInHandler,
change: this.teamComboChangeHandler
}
},
renderer: this.teamRenderer,
draggable: false,
width: 150,
locked: true
}
teamComboFocusInHandler = (({ source: teamCombo }) => {
const currentRowRole = teamCombo.record.role);
.
.
.
Can this be done?
Thanks
Ben
OK - turns out the placeholder value of "Select..." I had in the role dropdown initially was causing teamCombo.record to be undefined so i defaulted the initial value to something in the teamComboStore. But, now when I try to access teamCombo.record.role, it is undefined. When I inspect teamCombo.record it looks more like a record in the teamComboStore than the grid record but your example seemed to suggest I can access the grid record..
How do I access the grid record from the teamComboFocusInHandler?
How do I access the grid record from the teamComboFocusInHandler?
OK - turns out the placeholder value of "Select..." I had in the role dropdown initially was causing teamCombo.record to be undefined so i defaulted the initial value to something in the teamComboStore. But, now when I try to access teamCombo.record.role, it is undefined. When I inspect teamCombo.record it looks more like a record in the teamComboStore than the grid record but your example seemed to suggest I can access the grid record..
How do I access the grid record from the teamComboFocusInHandler?
How do I access the grid record from the teamComboFocusInHandler?
In general it is not a good idea to use undocumented features as they are subject to change. You can try navigating up from the combo to the grid and read record from store.
this.up('grid').store.getById(id)