Announcement

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

    ListGridField and ComboboxItem

    Hi everybody,

    I am using smartgwt 2.5 and firefox 5.0. In each record of a listgrid showing the data of a project I need to show the customer (its name) and to change it using a ComboboxItem.
    The problem is that, when I load the data, all the records show the same customer, while, when I edit the field, the combo shows me the correct customer.

    Here is how I mapped the project datasource fields with the customerId and the customer name.
    Code:
    DataSourceTextField customerField = new DataSourceTextField(fields.customer(), labels.customer());
    clienteField.setValueXPath("//customername");
    DataSourceIntegerField idCustomerField = new DataSourceIntegerField(fields.idCustomer());

    I extended the ListGrid class to create the project listgrid and defined the customer field like this.
    Code:
    idCustomerField = new ListGridField(fields.idCustomer(), 200);
    ComboBoxItem cbiSuggester = new ComboBoxItem();
    cbiSuggester.setOptionDataSource(CustomersDatasource.instance());
    cbiSuggester.setValueField(fields.id());  // field name of customer id in the customer dataset
    cbiSuggester.setDisplayField(fields.name()); // field name of customer name in the customer dataset
    idCustomerField.setEditorType(cbiSuggester);
    idCustomerField.setDisplayField(fields.customer()); // field name of customer name in the project dataset
    The optiondatasource is that with all the customers.

    Thanks for your help

    Ciao Francesco
Working...
X