PDA

View Full Version : Populating parent grid from editor combo



IUnknown74
11 Sep 2014, 8:36 PM
have a grid in ext 3.4 having one of the columns with a combobox editor.


{header: ' Facility', dataIndex: 'facility',editor: borrfacCombo}The underlying store of the grid has 2 fields (and more) - facility and facilityid
The editor combo is loaded from a store which has a mapping of id and description(something similar to below):


borrfacCombo=Ext.create('Ext.form.field.ComboBox', { displayField: 'name', valueField: 'id', store: { fields: ['id', 'name'], data: [ {id: 'scheme2', name: 'Green Envy'}, ... ] } }); When a particular 'facility' is selected in the combo - I need the corresponding 'facilityid' to be populated in the selected row of the grid's store.
i am trying the following on 'select' in the combo -


listeners:{select:function(combo, record, index) { var val=record.get('id'); var grid=combo.ownerCt.floatParent; var selectedRecord = grid.getSelectionModel().getSelection()[0];.... } } But 'combo.ownerCt' always shows up as 'undefined'.
How do I resolve this ?

Kachopsticks
1 Oct 2014, 7:32 AM
Not sure why ownerCt is not set up. Maybe the combo box is not set up correctly. As a work around you could fire a global event from your select function and just have your grid listen for it. Once the grid hears the event you can update what you need to in your grid. Good luck... You may want to read this thread and try var parent = combo.getEl().parent();got that from http://www.sencha.com/forum/showthread.php?42353-component-ownerCt-property-always-undefined-..