PDA

View Full Version : Loading combo box in Grid dynamically only works once. Then editor is null



blomasky
14 Aug 2013, 2:06 PM
I have a grid where some columns in the record have to be used to fill the choices in a combo box. My grid column is this:


xtype: 'gridcolumn', itemId: 'customerUM',
width: 66,
dataIndex: 'customerUM',
text: 'U/M',
editor: {
xtype: 'combobox',
queryMode: 'local',
store: [
'FBM',
'PCS'
]
}
},

I have an select event on the grid that does this:

var grid = this.getContactGrid(),
gridHeader = grid.getView().headerCt,
customerUM = gridHeader.child('#customerUM');




customerUM.editor.store = Array(record.data.UM, record.data.UE, record.data.UP);




works fine for the 1st row I edit, but when I select another row, the customerUM.editor is null

Help

Thanks
Bruce

slemmon
19 Aug 2013, 2:39 PM
What about doing editor.getStore().loadData() on each selection.

Also, you might find that using the beforeedit event gives you access to the editor, column, etc right from the listener - for ease of use:
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.plugin.CellEditing-event-beforeedit