I have EditorGridPanel and in that one of the cells I am showing
ComboBox to the user. With the below code combobox is displayed in a
cell when I click on a cell. Also I can see list of countries which
are retrieved from database. Problem is when I select a country from
combobox, and when focus is lost from that combobox, the value of
countryPk is displayed instead of country name. Where I am expecting
the value of countryPk should be send to server and country name
should be displayed to user.
Please help me in this problem.
// Code to add combobox to the gridpanel
----------------------------------------------------
------------------------------------------------------------------------------------------------------------
ColumnConfig countryConfig = new ColumnConfig("Country", "countryPk",
100);
final String[] countryHeadings = new String[]{"countryPk",
"country"};
final ComboBox countryComboBox = new ComboBox("Select
Country","countryPk");
final Store gridCountriesStore = new SimpleStore(countryHeadings, new
String[][]{});
gridCountriesStore.load();
countryComboBox .setStore(gridCountriesStore);
countryComboBox .setDisplayField("country");
countryComboBox .setMode(ComboBox.LOCAL);
countryComboBox .setTriggerAction(ComboBox.ALL);
countryComboBox .setForceSelection(true);
countryComboBox .setValueField("countryPk");
countryComboBox .setReadOnly(true);
countryComboBox.addListener(new ComboBoxListenerAdapter() {
LookupController lookupController = new
LookupController();
@Override
public void onFocus(Field field) {
lookupController.updateCountriesComboStore
(gridCountriesStore, countryHeadings);
}
});
countryConfig.setEditor(new GridEditor(countryComboBox));
countryConfig.setWidth(60);
//
------------------------------------------------------------------------------------------------------------
//Code to get update the countries store
………………………………………………………………………………………….-----------------------------------
---------------------------------------------------------------------------------------------------------------
private LookupServiceAsync service = (LookupServiceAsync) GWT.create
(LookupService.class);
public void updateCountriesComboStore(final Store store, final String
[] headings) {
GWT.log("Calling getCountries() of LookupServiceImpl",
null);
service.getCountries(new AsyncCallback<String[][]>(){
public void onFailure(Throwable caught) {
GWT.log("Unable to retreive Countries from
ServletContext scope", null);
}
public void onSuccess(String[][] result) {
GWT.log("Retrieve Countries from
ServletContext scope", null);
StoreCreator.updateStore(store, headings,
result);
}
});
}
//-------------------------------------------------------------------------------------------------------------
// Code to update any given store object
----------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
public static void updateStore(final Store store, String[] headings,
String[][] data)
{
if (store != null)
{
Store storeTemp = new SimpleStore(headings, data);
storeTemp.reload();
store.removeAll();
store.add(storeTemp.getRecords());
}
}
-----------------------------------------------------------------------------------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---