Hi Isomorphic,
please see this video (v11.1p_2018-02-16) where client side filtering brings the wrong result and server side filtering after an invalidateCache() corrects the issue.
This only happens when the filterRow-SelectItem is setMultiple(true):
As you can see in the filter dropdown, Kirill Amirov has a "4" in the employeeId, so these rows are also shown, because the client side filtering has a bug here.
BuiltInDS.java:
employees.ds.xml:
Please note that this does not happen when applying the "name startsWith A" filter on the client side as there for some reason client side filtering is not used even though all rows are loaded. I'll open a different thread for this one.
This does also happen in my application.
Best regards
Blama
please see this video (v11.1p_2018-02-16) where client side filtering brings the wrong result and server side filtering after an invalidateCache() corrects the issue.
This only happens when the filterRow-SelectItem is setMultiple(true):
As you can see in the filter dropdown, Kirill Amirov has a "4" in the employeeId, so these rows are also shown, because the client side filtering has a bug here.
BuiltInDS.java:
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.Version; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.data.SortSpecifier; import com.smartgwt.client.types.Autofit; import com.smartgwt.client.types.SortDirection; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.IButton; import com.smartgwt.client.widgets.Window; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; import com.smartgwt.client.widgets.form.fields.ComboBoxItem; import com.smartgwt.client.widgets.form.fields.SelectItem; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.layout.VLayout; public class BuiltInDS implements EntryPoint { private VLayout mainLayout; private IButton recreateBtn; public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); mainLayout = new VLayout(20); mainLayout.setWidth100(); mainLayout.setHeight100(); recreateBtn = new IButton("Recreate"); recreateBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { recreate(); } }); mainLayout.addMember(recreateBtn); recreate(); mainLayout.draw(); } private void recreate() { Window w = new Window(); w.setWidth("20%"); w.setHeight("40%"); w.setMembersMargin(0); w.setModalMaskOpacity(70); w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")"); w.setTitle("Filtering with Multiple SelectItem is using substring for IDs" + w.getTitle()); w.setShowMinimizeButton(false); w.setIsModal(true); w.setShowModalMask(true); w.centerInPage(); final ListGrid employeesGrid = new ListGrid(DataSource.get("employees")); employeesGrid.setAutoFitData(Autofit.VERTICAL); employeesGrid.setAutoFetchData(false); employeesGrid.setShowFilterEditor(true); employeesGrid.setFilterOnKeypress(true); ListGridField employeeId = new ListGridField("EmployeeId"); employeeId.setCanEdit(false); ListGridField name = new ListGridField("Name"); name.setCanEdit(false); ListGridField gender = new ListGridField("Gender"); ListGridField reportsTo = new ListGridFieldReportsTo("ReportsTo"); ListGridField job = new ListGridField("Job"); employeesGrid.setFields(employeeId, name, gender, reportsTo, job); employeesGrid.setSort(new SortSpecifier[] { new SortSpecifier(name.getName(), SortDirection.ASCENDING) }); employeesGrid.setFetchOperation("fetchA"); employeesGrid.fetchData(); w.addItem(employeesGrid); IButton reloadBtn = new IButton("Reload"); reloadBtn.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { employeesGrid.invalidateCache(); } }); w.addItem(reloadBtn); w.show(); } private class ListGridFieldReportsTo extends ListGridField { public ListGridFieldReportsTo(String name) { super(name); { ComboBoxItem managerCBI = new ComboBoxItem(); managerCBI.setOptionDataSource(DataSource.get("employees")); managerCBI.setValueField(DataSource.get("employees").getPrimaryKeyFieldName()); managerCBI.setDisplayField("Name"); managerCBI.setPickListSort(new SortSpecifier[] { new SortSpecifier("EmployeeId", SortDirection.ASCENDING), new SortSpecifier("Name", SortDirection.ASCENDING) }); ListGridField managerCBI_empIdLGF = new ListGridField("EmployeeId"); ListGridField managerCBI_nameLGF = new ListGridField("Name"); managerCBI.setPickListFields(managerCBI_empIdLGF, managerCBI_nameLGF); managerCBI.setPickListHeaderHeight(0); setEditorProperties(managerCBI); } { SelectItem managerCBI = new SelectItem(); managerCBI.setOptionDataSource(DataSource.get("employees")); managerCBI.setValueField(DataSource.get("employees").getPrimaryKeyFieldName()); managerCBI.setDisplayField("Name"); managerCBI.setPickListSort(new SortSpecifier[] { new SortSpecifier("EmployeeId", SortDirection.ASCENDING), new SortSpecifier("Name", SortDirection.ASCENDING) }); ListGridField managerCBI_empIdLGF = new ListGridField("EmployeeId"); ListGridField managerCBI_nameLGF = new ListGridField("Name"); managerCBI.setPickListFields(managerCBI_empIdLGF, managerCBI_nameLGF); managerCBI.setPickListHeaderHeight(0); [B] setMultiple(true);[/B] setFilterEditorProperties(managerCBI); } } } }
Code:
<DataSource ID="employees" serverType="sql" tableName="employeeTable" recordName="employee" testFileName="/examples/shared/ds/test_data/employees.data.xml" titleField="Name" useAnsiJoins="true" > <fields> <field name="userOrder" title="userOrder" type="integer" canEdit="false" hidden="true"/> <field name="Name" title="Name" type="text" length="128"/> <field name="EmployeeId" title="Employee ID" type="integer" primaryKey="true" required="true"/> [B] <field name="ReportsTo" title="Manager" type="integer" foreignKey="employees.EmployeeId" displayField="ReportsToName" joinType="outer" /> <field name="ReportsToName" includeFrom="employees.Name" />[/B] <field name="Job" title="Title" type="text" length="128"/> <field name="Email" title="Email" type="text" length="128"/> <field name="EmployeeType" title="Employee Type" type="text" length="40"/> <field name="EmployeeStatus" title="Status" type="text" length="40"/> <field name="Salary" title="Salary" type="float"/> <field name="OrgUnit" title="Org Unit" type="text" length="128"/> <field name="Gender" title="Gender" type="text" length="7"> <valueMap> <value>male</value> <value>female</value> </valueMap> </field> <field name="MaritalStatus" title="Marital Status" type="text" length="10"> <valueMap> <value>married</value> <value>single</value> </valueMap> </field> </fields> [B] <operationBindings> <operationBinding operationType="fetch" operationId="fetchA"> <criteria fieldName="Name" operator="startsWith" value="A" /> </operationBinding> </operationBindings>[/B] </DataSource>
This does also happen in my application.
Best regards
Blama
Comment