Hi Isomorphic,
please see this testcase (v11.1p_2017-09-11). It seems that for fields with displayField and the filter string is not displayed after filtering, even though the does filter.
Also, the request after a invalidateCache() does include the expected criteria (see the "Reload" button).
The issue seems to be related to the line reportsTo.setFilterOperator(OperatorId.ICONTAINS) in the code.

BuiltInDS.java:
employees.ds.xml:
Best regards
Blama
please see this testcase (v11.1p_2017-09-11). It seems that for fields with displayField and the filter string is not displayed after filtering, even though the does filter.
Also, the request after a invalidateCache() does include the expected criteria (see the "Reload" button).
The issue seems to be related to the line reportsTo.setFilterOperator(OperatorId.ICONTAINS) in the code.
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.AdvancedCriteria;
import com.smartgwt.client.data.Criterion;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.SortSpecifier;
import com.smartgwt.client.types.OperatorId;
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.TextItem;
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("95%");
w.setHeight("95%");
w.setMembersMargin(0);
w.setModalMaskOpacity(70);
w.setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
w.setTitle("ListGrid has problem with filtering for fields with displayField" + w.getTitle());
w.setShowMinimizeButton(false);
w.setIsModal(true);
w.setShowModalMask(true);
w.centerInPage();
final ListGrid employeesGrid = new ListGrid();
employeesGrid.setHeight100();
employeesGrid.setAutoFetchData(false);
employeesGrid.setDataSource(DataSource.get("employees"));
employeesGrid.setShowFilterEditor(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 ListGridField("ReportsTo");
[B] // Without, it is displaying, but using equals criteria
reportsTo.setFilterOperator(OperatorId.ICONTAINS);[/B]
reportsTo.setFilterEditorProperties(new TextItem());
ListGridField job = new ListGridField("Job");
employeesGrid.setFields(employeeId, name, gender, reportsTo, job);
employeesGrid.setSort(new SortSpecifier[] { new SortSpecifier(reportsTo.getName(), SortDirection.ASCENDING) });
employeesGrid.fetchData(new AdvancedCriteria(new Criterion(name.getName(), OperatorId.STARTS_WITH, "A")));
w.addItem(employeesGrid);
IButton reloadBtn = new IButton("Reload", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
employeesGrid.invalidateCache();
}
});
w.addItem(reloadBtn);
w.show();
}
}
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"/>
<field name="ReportsTo" title="Manager" type="integer" required="true"
foreignKey="employees.EmployeeId" rootValue="1" displayField="ReportsToName" />
<field name="ReportsToName" includeFrom="employees.Name" title="Manager name" />
<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>
</DataSource>
Blama
Comment