Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGridField Display Problem

    1. GWT Version: 2.1.0
    2. Browser: IE8 and FF 24.3.0

    I have a set of tabs, each which contains a ListGrid, each of which are populated with different data sets.

    One of my ListGrid's have a ListGridField with an optionDataSource set to map a code to a human readable list.

    For example sake we can talk about currencies where the record data is GBP which maps to an item "Great Britain Pound". When I first populate the ListGrid with.

    listGrid.setData(records);

    The field initially shows the value field GBP and not the display field "Great Britain Pound". I can then click to a different tab, and then click back to this tab and it shows the display field properly. Likewise if I select the drop down list it changes it as expected to the display field.

    My initial thinking is that some how the options data source is not populated yet, or after it has been populated the field needs redrawn again.

    I create my list grid field as follows:

    ListGridField listGridField = new ListGridField("listGridField", "Currencies");
    listGridField.setOptionDataSource(new MyDataSource());
    listGridField.setDisplayField("display");
    listGridField.setValueField("value");
    listGridField.setRequired(true);
    listGridField.setEmptyCellValue("Select...");
    listGridField.setType(ListGridFieldType.TEXT);
    listGridField.setCanEdit(true);
    // I have tried with and without these.
    listGridField.setDisplayValueFromRecord(true);
    listGridField.setAutoFetchDisplayMap(true);

    #2
    Hi milesy303,

    this might be related to your problem. I don't think that a new MyDataSource() is the object to feed to setOptionDataSource(), use DataSource.get("myDS") instead.

    This is used in the samples and the Quick Start Guide, although a can't find a recommendation for this practice right now.

    Best regards,
    Blama

    Comment

    Working...
    X