Announcement

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

    MultiItem ListGrid filtering

    Hi everyone, I'm quite new to SmartGWT so please bear with me. I'm currently setting up a ListGrid with filters but I'm currently having problems in implementing a filter for fields with multiple item selection. Can anyone guide me for an example on this?

    Here's an example of what I want to achieve:

    I have a ListGrid with these values:
    ______________
    |Fruits Selected|
    |_____________|
    |Apple |
    |Apple,Orange |
    |Orange |
    |_____________|

    When I try to filter and select Orange in my "Multi-Item Filter" I expect to see this on my grid:
    ______________
    |Fruits Selected|
    |_____________|
    |Apple,Orange |
    |Orange |
    |_____________|

    But instead, I only see this:

    ______________
    |Fruits Selected|
    |_____________|
    |Orange |
    |_____________|

    Am I interpreting the expected output wrong? If so, is there a way that I can customize the way that multiple item filter is handled?

    TIA. Sorry I currently can't create a sample simple test case.

    Another thing, I'm using GenericGwtRpcDataSource from this forums. Hopefully this is not an issue.

    Here's a sample code for more details:
    DataSource:
    Code:
    public class FruitLocalDS extends DataSource {
    
    private static FruitLocalDS instance = null;
    
    public static FruitLocalDS getInstance() {
        if (instance == null) {
            instance = new FruitLocalDS("supplyItemLocalDS");
        }
        return instance;
    }
    
    public FruitLocalDS(String id) {
        setID(id);
    
        DataSourceEnumField fruitNameField = new DataSourceEnumField(
                "fruitNames", "Fruit Name");
        fruitNameField.setMultiple(true);
        fruitNameField.setValueMap("Apple", "Guyabano", "Pineapple", "Orange",
                "Grapes");
    
        setFields(fruitNameField);
        setClientOnly(true);
        setTestData(Fruit.getDummyRecords());
    }}
    ListGridRecord:

    Code:
    public class Fruit  extends ListGridRecord {
    
    public Fruit(String[] fruitNames) {
        setFruitNames(fruitNames);
    }
    
    public void setFruitNames(String[] fruitNames) {
        setAttribute("fruitNames", fruitNames);
    }
    
    public String getFruitName() {
        return getAttribute("fruitNames");
    }
    
    public static Fruit[] getDummyRecords() {
        return new Fruit[] {
                new Fruit(new String[]{"Orange"}), 
                new Fruit(new String[]{"Apple", "Orange"}),
                new Fruit(new String[]{"Guyabano","Orange"}),
                new Fruit(new String[]{"Pineapple","Orange"}),
        };
    }}
    EntryPoint:
    Code:
    public class MultiItemTest implements EntryPoint {
    public void onModuleLoad() {
        final DataSource dataSource = FruitLocalDS.getInstance();
    
        ListGrid listGrid = new ListGrid();
        listGrid.setWidth(1000);
        // listGrid.setAutoFitData(Autofit.VERTICAL);
        listGrid.setHeight(224);
        listGrid.setDataPageSize(50);
        listGrid.setDataSource(dataSource);
        listGrid.setShowFilterEditor(true);
        listGrid.setCanEdit(true);
        listGrid.setAutoFetchData(true);
        listGrid.setEditEvent(ListGridEditEvent.DOUBLECLICK);
    
        listGrid.setShowRowNumbers(true);
        listGrid.setFilterOnKeypress(true);
        listGrid.setFetchDelay(1);
    
        listGrid.draw();
    }}
    When you try selecting 'Orange' in the filter it will only show:

    Code:
    Orange
    what I expect is:

    Code:
    Apple,Orange
    Guyabano,Orange
    Orange
    Pineapple, Orange
    Am I doing something wrong?
    Attached Files
    Last edited by sushifan; 5 Jan 2013, 11:19. Reason: Added sample code.

    #2
    up.

    Any ideas on this?

    Comment


      #3
      up for this post. need help. :)

      Comment


        #4
        Anyone? Upping this thread again.

        Comment


          #5
          Seriously, no one has encountered this issue yet? TIA

          Comment


            #6
            bumping this post. Anyone knows the answer?

            Comment

            Working...
            X