Announcement

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

    SelectItem Issue with PickListCriteria

    Im using the following Version of SmartGWT:
    v8.3_2012-11-20/PowerEdition Deployment 2012-11-20
    on Firefox 18.0.1

    I'm using an optionDataSource on a select item with the following values:
    Code:
    ID:NAME
     1:A
     2:B
     3:C
     4:BX
     6:CX
     7:AX
    14:AB
    The SelectItem is initialized this way:

    Code:
    SelectItem selector=new SelectItem();
    selector.setOptionDataSource(DataSources.ds);//Data Source for the table up there
    selector.setValueField("ID");
    selector.setDisplayField("NAME");
    Now depending on a list selection I want to filter the shown values, but there occurs a problem. First the code where I build my pickListCriteria:

    Code:
    public void selectionChanged() {
        Criteria crit = null;
        for (Integer id : getFilterIds()) {
            if (crit == null) {
                crit = new Criteria("ID", "" + id);
            } else {
                crit = DataSource.combineCriteria(crit,
                           new Criteria("ID", "" + id),
                           CriteriaCombineOperator.OR);
            }
        }
        if (crit != null) {
           selector.setPickListCriteria(crit);
        }
    }
    Now I get a strange behaviour:
    {1} as input results in {A,AB} as selectable Options
    {1,2,4} results in the full list
    {1,4} results in an empty selector

    What am I doing wrong? Is this the right way to filter the Options?

    #2
    If by 1,2 as "input" you mean that's what you typed in the field, this wouldn't be understood as multiple inputs - you want MultiComboBoxItem instead.

    Comment


      #3
      No, i meant that getFilterIds() returns a list of IDs, which should represent the available options of the selectItem. I don't want to select multiple options, but the the options I get are not filtered as expected.

      E.g. if it returns {1} only A should be selectable, but A and AB are visible in the picklist. if it returns {1,2,4} A, B and BX should be available, but the whole list (A, B, C, BX, CX, AX, AB) is and when it returns {1,4} the picklist is empty.

      Comment


        #4
        Take a look at the data you are returning from the server in the RPC tab of the Developer Console. Most likely something is wrong in this data.

        If its not obvious what's wrong, post the data here.

        Comment

        Working...
        X