PDA

View Full Version : Grid editing combobox problem



extremed
9 Jan 2012, 12:23 AM
Hi

i have a gridrowediting with column like this


{ header: 'Supplier', dataIndex: 'supplier', flex: 2,
field: {
xtype : 'combo',
store : Ext4.getStore('supplierStore'),
queryMode : 'local',
displayField : 'name',
valueField : 'value',
forceSelection : true,
allowBlank : false
}
}

so once row is edited this writes value field into store.

but problem is grid also showing value field instead of display field. any idea how to solve this?

Regards

mitchellsimoens
9 Jan 2012, 9:15 AM
Do you have a renderer on the column?

extremed
9 Jan 2012, 9:19 AM
nope. no idea how to send a display value to grid and write different value to store

mitchellsimoens
9 Jan 2012, 9:24 AM
So if your dataIndex matches the valueField on your combobox, it will always display the value field. I would then use a renderer on the column and return a different string.

extremed
9 Jan 2012, 10:11 AM
do you have any example?

Regards

mitchellsimoens
9 Jan 2012, 10:39 AM
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.grid.column.Column-cfg-renderer

And there are examples that come with Ext JS 4 that use renderer.

skirtle
10 Jan 2012, 4:47 AM
The ExtJS 3 docs give a specific example of this, not sure it's made it into the 4 docs:

http://docs.sencha.com/ext-js/3-4/#!/api/Ext.form.ComboBox

In the intro docs you'll see a guide to using a combobox in a grid and how to write a renderer based on a combobox. Personally I'd prefer to base the renderer on the store instead but I can see the merits of doing it this way.

extremed
10 Jan 2012, 5:01 AM
thanks