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:
ListGridRecord:
EntryPoint:
When you try selecting 'Orange' in the filter it will only show:
what I expect is:
Am I doing something wrong?
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()); }}
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"}), }; }}
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(); }}
Code:
Orange
Code:
Apple,Orange Guyabano,Orange Orange Pineapple, Orange
Comment