PDA

View Full Version : Combobox value replace with grid selected Value..!!!



nihar1987
28 Mar 2012, 3:09 PM
Hi,
i have a window with grid and form panel. Here is the picture of the window..33279
if user selects any record, then their respective values are populated to the form panel fields..
In form panel i have a combo box which has different store values.. for example when user selects last row of grid.. then combo box display field matches with first name of grid panel.. but when user selects other rows... then combo box is showing empty text...

here goes the code for that window GridPanelSelectionChange function code :


buildGridPanel: function () {
return {
//grid panel configs goes here with item id...
xtype: 'EntitleGridPanel',
itemId: 'grid',
listeners: {
scope: this,
// custom relayed events from grid's selmodel
select: this.onGridPanelSelectionChange
}
}
},

buildFormPanel: function () {
return {
// form panel configs goes here with item id...
xtype: 'EntitleFromPanel',
itemId: 'form',
listeners: {
scope: this,
// custom event
savebtn: this.onFormPanelSaveBtn
}
}
},

getFormPanel: function (record) {
return this.getComponent('form');
},

getGridPanel: function () {
return this.getComponent('grid');
},

onGridPanelSelectionChange: function (me, record, index, opts) {
console.log('in click ');
console.log(record.get('age'));
if (record) {
this.getFormPanel().getForm().loadRecord(record);
}
},


previously i went with id for the components using Ext.getCmp() and replaced the value...



if (rec.get('first') == null) {
Ext.getCmp('wincmb').setValue('');
}
else {
Ext.getCmp('wincmb').setValue(rec.get('first').replace(/^\s+|\s+$/g, ''));
}


but now i dont want to use Ext.getCmp....

is there any better way to solve this issue...

Thanking you all in advance.. :)

mitchellsimoens
29 Mar 2012, 7:16 AM
The value in the model that correlates to the name combobox, is it a valid option in the combobox's store?

nihar1987
29 Mar 2012, 7:55 AM
No, the value from the grid row is not same as the value in combo box store... is it possible to get value from the grid cell to combo box display field (which doesn't have identical values.. )