Hi,
Using the FilterBuilder, is there a way to search for Master Fields by specifying specific detail fields?
I.e. given the following DSs
and
and Code
is it possible to formulate a query like “Detail field contains detail1 and detail2 and not detail3” to return corresponding Master fields?
Using the standard filter Editor (above the grid), it is possible to formulate “or” queries like “Detail field contains detail1 or detail2 or detail3” which work without problems. Since I need more complex queries, I tried the FilterBuilder but it did not generate proper Critieria even when simulating the filter Editor.
I.e. When selecting some values in its SelectItem, the filter Editor generates
whereas the FilterBuilder (using “is one of”) generates criterias like
In addition, I cannot properly set the detail fields in the FilterBuilder (i.e. values are forgotten and in the field it just shows detail7, detail7 when in fact detail6, detail5 was selected; see screeshot). This all looks like a bug to me. An Eclipse project showing the issue is here (https://dl.dropboxusercontent.com/u/...tailFilter.zip) for reference (LGPL libs need to be put in libs and the project needs to be compiled).
Thanks & cheers,
fatzopilot
SGWT: SmartClient Version: v9.1d_2014-02-26/LGPL Development Only (built 2014-02-26)
GWT: 2.6.0
Browser: FF 26.0 (dev mode), Chrome 33.0.1750.154 m (prod mode)
Using the FilterBuilder, is there a way to search for Master Fields by specifying specific detail fields?
I.e. given the following DSs
Code:
setID(id); setRecordXPath("/List/d"); DataSourceIntegerField pkField = new DataSourceIntegerField("id"); pkField.setHidden(true); pkField.setPrimaryKey(true); addField(pkField); DataSourceTextField countryCodeField = new DataSourceTextField("n", "Master"); countryCodeField.setRequired(true); addField(countryCodeField); DataSourceTextField traits = new DataSourceTextField("e", "Detail"); traits.setChildrenProperty(true); traits.setMultiple(true); traits.setForeignKey("DetailDS.id"); traits.setDisplayField("n"); addField(traits); setDataURL("Master.data.xml"); setClientOnly(true);
Code:
setID(id); setRecordXPath("/List/t"); DataSourceIntegerField pkField = new DataSourceIntegerField("id"); pkField.setHidden(true); pkField.setPrimaryKey(true); addField(pkField); DataSourceTextField nameField = new DataSourceTextField("n", "Name"); nameField.setRequired(true); addField(nameField); setDataURL("Detail.data.xml"); setClientOnly(true);
Code:
@Override public void onModuleLoad() { final ListGrid listGrid = new ListGrid(); listGrid.setDataSource(MasterDS.getInstance()); listGrid.setWidth(1200); listGrid.setHeight(600);; listGrid.setShowFilterEditor(true); listGrid.setUseAdvancedFieldPicker(true); listGrid.setAlternateRecordStyles(true); listGrid.setAutoFetchData(true); listGrid.setCanEdit(false); listGrid.setCanRemoveRecords(false); listGrid.setCanMultiSort(true); listGrid.setShowFilterEditor(true); ListGridField detailField = new ListGridField("e", "Detail"); detailField.setOptionDataSource(DetailDS.getInstance()); detailField.setMultiple(true); detailField.setDisplayField("n"); detailField.setValueField("id"); detailField.setAutoFetchDisplayMap(true); detailField.setSortByDisplayField(true); final FilterBuilder filterBuilder = new FilterBuilder(); filterBuilder.setDataSource(MasterDS.getInstance()); ListGridField nameField = new ListGridField("n", "Master"); nameField.setWidth(200); listGrid.setFields(nameField, detailField); VLayout layout = new VLayout(15); IButton filterButton = new IButton("Filter"); filterButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { listGrid.filterData(filterBuilder.getCriteria()); } }); layout.addMember(filterBuilder); layout.addMember(filterButton); layout.addMember(listGrid); layout.draw(); }
Using the standard filter Editor (above the grid), it is possible to formulate “or” queries like “Detail field contains detail1 or detail2 or detail3” which work without problems. Since I need more complex queries, I tried the FilterBuilder but it did not generate proper Critieria even when simulating the filter Editor.
I.e. When selecting some values in its SelectItem, the filter Editor generates
Code:
criteria:[ { fieldName:"e", operator:"inSet", value:[ 3, 2 ] } ]
Code:
criteria:[ { operator:"inSet", fieldName:"e", value:[ null, null ] } ]
Thanks & cheers,
fatzopilot
SGWT: SmartClient Version: v9.1d_2014-02-26/LGPL Development Only (built 2014-02-26)
GWT: 2.6.0
Browser: FF 26.0 (dev mode), Chrome 33.0.1750.154 m (prod mode)
Comment