Thanks a lot Stefano ... I have done as you suggested and its working
fine.

Thanks and Regards,
kilaru

On Sep 23, 1:16 pm, Stefano Gargiulo <[email protected]> wrote:
> PS. where    entimap is a public static variable of an utility class eg.
> CommonsUIVars.class
>
> 2009/9/23 Stefano Gargiulo <[email protected]>
>
>
>
> > Hi, in the render method override the record parameter that you are using
> > is not referred to the combobox's store record but to the grid one.. then is
> > not useful for what you want to do...
>
> > for this i've suggested to create a static hash map from the String[][]
> > every time you reload it from RPC:
>
> > for instance you can have these utility methods:
>
> >       /**
> >      * @return the enti
> >      */
> >     public static String[][] getEnti() {
> >         return enti;
> >     }
>
> >       /**
> >      * @param aEnti the enti to set
> >      */
> >     public static void setEnti(String[][] aEnti) {
> >         enti = aEnti;
> >         int i=0;
> >         entimap=new HashMap();
> >         while (i<enti.length){
> >             entimap.put(enti[i][0], enti[i++][1]);
> >         }
> >     }
>
> >> so, i used the below code to solve the problem. but i am getting null
> >> from record.getAsString("
>
> > countryName");
>
> >>    col.setRenderer(new Renderer() {
> >>            public String render(Object value, CellMetadata
> >> cellMetadata,Record record,
> >>                        int rowIndex, int colNum, Store store) {
> >>                 String name = record.getAsString("countryName");
> >>                return name;
> >>            }
> >> });
>
> > 2009/9/23 Patrizio De Michele <[email protected]>
>
> > maybe there are some parts of your code skipped for some exception....
> >> insert some system out at the end of your methods and see if the text is
> >> outputted....
> >> how you update your store onFocus?
> >> you call a store.removeAll() and after you append new data??
> >> hope it helps, Pat
>
> >> 2009/9/23 kilaru <[email protected]>
>
> >>> Thanks for your answer.
>
> >>>  i have implemented as you have said. but i have String[][] for me for
> >>> countries, where i am storing (id, value)
>
> >>> as i am having this store.
> >>> Store gridCountriesStore = new SimpleStore(new String[]{"countryid",
> >>> "countryName"}, new String[][]);
>
> >>> and i am updating this store with values in "onFocus" method of
> >>> ComboBoxListenerAdapter. and i am getting values in to store as
>
> >>> // copied this while debugging in the eclipse.
> >>> [[1, INDIA], [2, US], [11, UK], [12, Australia], [13, England], [14,
> >>> Srilanka], [15, China], [16, West Indies], [17, Asia], [19, South
> >>> America], [24, Africa]]
>
> >>> i am able to see country names when i see int he dropdown. but after
> >>> selecting a particular country and tabbing out from there, immediately
> >>> id is populated in the grid cell.   For Example: if i select England
> >>> from dropdown, and tabbed out from there, 13 is displayed in the cell.
>
> >>> so, i used the below code to solve the problem. but i am getting null
> >>> from record.getAsString("countryName");
>
> >>>    col.setRenderer(new Renderer() {
> >>>            public String render(Object value, CellMetadata
> >>> cellMetadata,Record record,
> >>>                        int rowIndex, int colNum, Store store) {
> >>>                 String name = record.getAsString("countryName");
> >>>                return name;
> >>>            }
> >>> });
>
> >>> please help me..
>
> >>> On Sep 22, 12:51 pm, Stefano Gargiulo <[email protected]> wrote:
> >>> > i had the same problem... it solved it setting a custom render for the
> >>> cell:
> >>> > col.setEditor(cbeditor);
> >>> > col.setRenderer(new Renderer() {
>
> >>> >             public String render(Object value, CellMetadata
> >>> cellMetadata,
> >>> > Record record,
> >>> >                     int rowIndex, int colNum, Store store) {
> >>> >                 return (String)
> >>> > SharedUIControls.compartIDtoValueMap.get(value.toString());
> >>> >             }
> >>> >     });
>
> >>> > where `compartIDtoValueMap` is a static HashMap populed via GWT RPC at
> >>> > application startup (and whatever is needed)
>
> >>> > 2009/9/22 kilaru <[email protected]>
>
> >>> > >  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
-~----------~----~----~----~------~----~------~--~---

Reply via email to