PDA

View Full Version : EditorGrid ComboBox Edit problem



merianos
21 Jul 2009, 2:16 AM
Hello all :)

I'm creating an EditorGrid and I like to have one column with ComboBox editor installed on it.

What I'm writting is that :



usersCM = new Ext.grid.ColumnModel(
[
{
header: '#',
dataIndex: 'id',
width: 30,
id: 'id'
},
{
header: '????? ??????',
dataIndex: 'name',
id: 'name',
editor: new Ext.form.TextField(
{
allowBlank: false,
minLength: 4,
maxLength: 16
}
)
},
{
header: '?????',
dataIndex: 'group',
id: 'group',
editor: new Ext.form.ComboBox(
{
allowBlank: false,
store: groupsDS,
valueField: 'id',
displayField: 'name',
mode: 'local'
}
)
}
]
);
My problem is that When I change the value of the cell by using the embeded ComboBox instead of the chosen name I'm getting back the id of the chosen name.

in example:

If I choose from the Combo box the 'Managers' I'm getting back the number 2 after the value has change and not the string 'Managers'

Any idea on this problem ? ? ?

Thanks a lot :)

Condor
21 Jul 2009, 2:26 AM
Does the 'group' field contain the 'id' or the 'name'?

If it contains the 'name' then you shouldn't configure your combobox with a valueField.

If it contains the 'id' then you also need a renderer that returns the name of the id.

merianos
21 Jul 2009, 2:35 AM
Does the 'group' field contain the 'id' or the 'name'?

If it contains the 'name' then you shouldn't configure your combobox with a valueField.

If it contains the 'id' then you also need a renderer that returns the name of the id.

What I done was to remove the valueField: 'id' and now return the Name, but is that correct ? ? ?

Condor
21 Jul 2009, 2:38 AM
I don't know... You didn't mention which of the 2 options you wanted to use.

merianos
21 Jul 2009, 2:43 AM
I don't know... You didn't mention which of the 2 options you wanted to use.

I think is ok because I use the afteredit listener and return what I need.

Thanks a lot :)