I'm using SmartGWT 2.4 LGPL with Java.
I'm using Editable ListGrid without DataSource.
One of my fields contain ComboboxItem (without DataSource) as an Editor.
This ComboboxItem holds a LinkedHashMap<String, String>, that is, LinkedHashMap<Id, Name>.
When I'm selecting value from the ComboboxItem it's showing the value field (Name), which is correct. But as soon as I'm done with the selection, it's showing the key field (Id), which is the issue I'm trying to solve.
Following is the sample code to generate the issue:
Following are the screenshots for better understanding:
while selection
http://i.stack.imgur.com/4Pn7O.png
after selection
http://i.stack.imgur.com/L56jj.png
P.S. I can't use DataSource, neither for ListGrid nor for ComboboxItem.
How should I overcome this issue?
I'm using Editable ListGrid without DataSource.
One of my fields contain ComboboxItem (without DataSource) as an Editor.
This ComboboxItem holds a LinkedHashMap<String, String>, that is, LinkedHashMap<Id, Name>.
When I'm selecting value from the ComboboxItem it's showing the value field (Name), which is correct. But as soon as I'm done with the selection, it's showing the key field (Id), which is the issue I'm trying to solve.
Following is the sample code to generate the issue:
Code:
public void onModuleLoad() { VLayout layout = new VLayout(10); final ListGrid countryGrid = new ListGrid(); countryGrid.setWidth(500); countryGrid.setHeight(224); ListGridField nameField = new ListGridField("countryName", "Country"); ListGridField continentField = new ListGridField("continent", "Continent"); ComboBoxItem item = new ComboBoxItem(); LinkedHashMap<String, String> continentMap = new LinkedHashMap<String, String>(); continentMap.put("1", "c1"); continentMap.put("2", "c2"); continentMap.put("3", "c3"); continentMap.put("4", "c4"); item.setValueMap(continentMap); continentField.setEditorType(item); continentField.setCanEdit(true); countryGrid.setFields(nameField, continentField); countryGrid.setData(getRecords()); layout.addMember(countryGrid); layout.draw(); } private ListGridRecord[] getRecords() { ListGridRecord[] rec = new ListGridRecord[5]; ListGridRecord rec1 = new ListGridRecord(); rec1.setAttribute("countryName", "A1"); rec1.setAttribute("continent", "1"); ListGridRecord rec2 = new ListGridRecord(); rec2.setAttribute("countryName", "A2"); rec2.setAttribute("continent", "2"); ListGridRecord rec3 = new ListGridRecord(); rec3.setAttribute("countryName", "A3"); rec3.setAttribute("continent", "3"); rec[0] = rec1; rec[1] = rec2; rec[2] = rec3; return rec; }
while selection
http://i.stack.imgur.com/4Pn7O.png
after selection
http://i.stack.imgur.com/L56jj.png
P.S. I can't use DataSource, neither for ListGrid nor for ComboboxItem.
How should I overcome this issue?
Comment