Hello,
I'm having trouble getting the FetchMode.LOCAL ListGrid filtering to work with multiple valued fields mapped via option data source. Problem is reproduced with following code:
The option data source is a simple int->string mapping option data source bound to field in list grid with filtering enabled. What I am aiming at is a simple OR type filtering so that when option 1 is selected from the filter the grid would show all the rows with '1' in the "option" field array. I'm having trouble understanding what the filter actually now filters as the result makes no sense at all. Is this the expected behaviour or might this be a bug ?
Using Smartgwt 3.1d LGPL NIGHTLY-2012-09-27, Firefox.
br,
Marko
I'm having trouble getting the FetchMode.LOCAL ListGrid filtering to work with multiple valued fields mapped via option data source. Problem is reproduced with following code:
Code:
public void onModuleLoad() { SC.showConsole(); viewport = new VLayout(); viewport.setWidth100(); viewport.setHeight100(); // option data source final DataSource ods = new DataSource(); DataSourceIntegerField odsIdField = new DataSourceIntegerField("oid"); odsIdField.setPrimaryKey(true); odsIdField.setHidden(true); DataSourceTextField odsTextField = new DataSourceTextField("otext"); ods.setFields(odsIdField, odsTextField); ods.setClientOnly(true); ods.setTestData( getOption(1, "option 1"), getOption(2, "option 2") ); // data source for actual test data final DataSource ds = new DataSource(); DataSourceIntegerField dsIdField = new DataSourceIntegerField("id"); dsIdField.setPrimaryKey(true); dsIdField.setHidden(true); DataSourceIntegerField dsOptionField = new DataSourceIntegerField("option"); dsOptionField.setMultiple(true); ds.setFields(dsIdField, dsOptionField); ds.setClientOnly(true); ds.setTestData( getRecord(1, new int[]{1}), getRecord(2, new int[]{1, 2}) ); // local grid with filtering final ListGrid g = new ListGrid(); g.setSize("400", "400"); g.setDataSource(ds); g.setShowFilterEditor(true); g.setFilterOnKeypress(true); g.setCanEdit(true); g.setDataFetchMode(FetchMode.LOCAL); g.setAutoFetchData(false); // our listgridfield with option data source, maps option to otext via oid ListGridField of = new ListGridField("option"); of.setOptionDataSource(ods); of.setValueField("oid"); of.setDisplayField("otext"); g.setFields(of); ds.fetchData(null, new DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { final ResultSet resultSet = new ResultSet(ds); resultSet.setAllRows(response.getData()); g.setData(resultSet); } }); viewport.addMember(g); viewport.draw(); } public Record getOption(int id, String text) { Record r = new Record(); r.setAttribute("oid", id); r.setAttribute("otext", text); return r; } public Record getRecord(int id, int[] options) { Record r = new Record(); r.setAttribute("id", id); r.setAttribute("option", options); return r; }
Using Smartgwt 3.1d LGPL NIGHTLY-2012-09-27, Firefox.
br,
Marko
Comment