Announcement

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

    FilterEditorType ComboBoxItem

    LGPL version 3.0p;

    I want to use a ComboBoxItem as filterEditor for a field in a listGrid. Following the example everything works fine. But the problem is that the displayfieldnames should equal.

    For example (this works):
    Code:
    ListGridField field = new ListGridField("typeId");
    field.setDisplayField("typeName");
    fieldsetFilterEditorType(new ComboBoxItem());
    FormItem formItem = new FormItem(){{
    	setOptionDataSource(itemDS);
    	setDisplayField("typeName");
    }};
    field.setFilterEditorProperties(formItem);
    What I want to achieve is:
    Code:
    ListGridField field = new ListGridField("typeId");
    field.setDisplayField("typeName");
    fieldsetFilterEditorType(new ComboBoxItem());
    FormItem formItem = new FormItem(){{
    	setOptionDataSource(itemDS);
    	setValueField("ID");
    	setDisplayField("name");
    }};
    field.setFilterEditorProperties(formItem);
    The criteria should contain "typeId equals 10", instead of "typeName startsWith something"

    First (and most important reason is):
    There could be more then one reference to the ItemDS. lets say item1, item2 and item3. In the example use case, ItemDS should contain 2 extra fields, itemName2 and itemName3.

    Second: I want to filter on the ID value instead of the joined field.

    Is this possible? The default SelectItem filterEditor works fine and as expected. When I add the comboxItem as filterEditorType, it sends the DIsplayField name of ComboBoxItem in the criteria. This is not as expected.

    #2
    Same problem

    Smartgwt 3.0p; GWT 2.4

    I have the same problem. When i use ComboBoxItem as filterEditor on ListGridField the returned filter criteria value is allways the display field and display value.


    ComboBoxItem cb = new ComboBoxItem("idContractor");
    cb.setShowPickListOnKeypress(true);
    cb.setPickListWidth(350);
    cb.setSortField(orderField);
    cb.setEmptyDisplayValue("");
    cb.setRejectInvalidValueOnChange(true);
    cb.setShowPickListOnKeypress(true);
    cb.setOptionDataSource(ContractorDataSource.getInstance());
    cb.setAutoFetchDisplayMap(true);
    cb.setValueField("id");
    cb.setDisplayField("name");
    cb.setAlign(Alignment.LEFT);

    ListGridField contractor = new ListGridField("idContractor");
    contractor.setOptionDataSource(ContractorDataSource.getInstance());
    contractor.setAutoFetchDisplayMap(true);
    contractor.setValueField("id");
    contractor.setDisplayField("name");
    contractor.setAlign(Alignment.LEFT);

    contractor.setFilterEditorType(cb);


    theGrid.setFields(contractor...);


    Result when I filter the data via filterEditor is {name='name value'} instead {idContractor = 'id value'}

    Any ideas for workaround?

    Comment


      #3
      This is correct behavior. The value the user is typing is criteria for the displayField (what the user can see) not the valueField.

      Comment

      Working...
      X