View Full Version : Combobox value in & grid cell value

23 Sep 2007, 9:18 PM

This has been look at before but all the solutions I've seen look like horrible hacks.
I have an editable grid with a combobox in the field named 'group'. Combobox mode is "local".

The store used by the combobox is a SimpleStore with fields ["value", "display"] and data pulled from a static javascript array.

By definition the combobox should display one value and store another. This is fine so long as the field is focused and the combobox is visible since the combobox knows the value=>display relationship. The grid does not.

I'd post the JS code but it is machine generated (a complex PHP script generates the JS code from database metadata and configuration files) and the output looks awful. The idea is to reduce the work involved to web-enable a database to a handful of lines of code and some config files. Like Dataface, but using ExtJS nice look and usability. I'd like to release this PHP mini-framework at some point.

Also because of the PHP generated JS the best would be a solution that needn't be
aware of specific schemas.


PS. Despite above issue, and having evaluated many toolkits, I still think ExtJS is the "best" web 2.0 toolkit out there. My thanks to the development team.

26 Sep 2007, 12:09 PM
My fix/hack/solution:

Ext.apply(Ext, {
IDRenderer : function(dataset, field)
return function(value)
byId = dataset.getById(value);
if (byId == undefined)
return value;
return byId.data[field];

var cm_communitymembers = new Ext.grid.ColumnModel([
header: "ID",
dataIndex: "ID",
width: 50
header: "community",
dataIndex: "community",
width: 350,
renderer: new Ext.IDRenderer(store_user_communities, 'display'),
editor: new Ext.form.ComboBox ({
allowBlank: false,
allowDecimals: false,
editable: false,
store: store_user_communities,
mode: "local",
valueField: "value",
displayField: "display",
triggerAction: "all"

where store_user_communities is the datastore that the combobox uses....