PDA

View Full Version : Grid with ComboBox......i don't get it



Ceene
25 Aug 2011, 5:17 AM
Hallo

I searched the whole day in the internet and in this forum but I don't get it. I hope somebody can help me.

I have a Project with a Grid and 3 Cells (name,alter,jaNein). The first and the second cell is a TextField but the third cell is a ComboBox. Till here is everthing all right. I put a List in my ComboBox

private List<ComboEintrag> getComboEintrag() {
List<ComboEintrag> plants = new ArrayList<ComboEintrag>();
plants.add(new ComboEintrag("J", "Ja"));
plants.add(new ComboEintrag("N", "Nein"));
return plants;
}



ListStore<ComboEintrag> states = new ListStore<ComboEintrag>();
states.add(getComboEintrag());


Then I put my data in the Grid


private List<Plant> getData() {
List<Plant> plants = new ArrayList<Plant>();
plants.add(new Plant("Sascha", "29", "J"));
plants.add(new Plant("Steffi", "24", "N"));
return plants;
}




ListStore<Plant> plantList = new ListStore<Plant>();
plantList.add(getData());
grid = new Grid<Plant>(plantList, new ColumnModel(configs));



And now comes my question. How is it possible that in the third cell not the "N" or "J" is written but the "selfValue" from the ComboBox?

I hope my english was not too bad.

@moderator: Sorry for the wrong area, please put me in the right area.

aconran
2 Sep 2011, 11:19 AM
Moving this to GXT forums

micgala
5 Sep 2011, 3:36 AM
Check this sample:
http://www.sencha.com/examples/explorer.html#editablegrid

Basically, all you need to do is prepare the CellEditor for the comboBox case (preProcessValue and postProcessValue).
In the postProcessValue, you will then show the "description" column of your ComboEintrag.