我的过滤器没有重新加载网格,但是"排序升序","排序降序"和"列"工作得很好。我使用了本教程,但这个演示过滤器无法正常工作:http://www.sencha.com/examples-2/#filtergrid
onModuleLoad()
中的代码:
configs = new ArrayList<ColumnConfig>();
column = new ColumnConfig("id", "Id", 20);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
column = new ColumnConfig("name", "Név", 50);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
column = new ColumnConfig("address", "Cím", 100);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
column = new ColumnConfig("email", "Első email", 100);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
column = new ColumnConfig("startDate", "Feltöltés", 100);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
column = new ColumnConfig("changeDate", "Módosítás", 100);
column.setAlignment(HorizontalAlignment.LEFT);
configs.add(column);
cm = new ColumnModel(configs);
idFilter = new NumericFilter("id");
nameFilter = new StringFilter("name");
addressFilter = new StringFilter("address");
emailFilter = new StringFilter("email");
startDateFilter = new DateFilter("startDate");
changeDateFilter = new DateFilter("changeDate");
usersListGridFilter=new GridFilters();
usersListGridFilter.setLocal(true);
usersListGridFilter.clearFilters();
usersListGridFilter.addFilter(idFilter);
usersListGridFilter.addFilter(nameFilter);
usersListGridFilter.addFilter(addressFilter);
usersListGridFilter.addFilter(emailFilter);
usersListGridFilter.addFilter(startDateFilter);
usersListGridFilter.addFilter(changeDateFilter);
usersListGridFilter.setAutoReload(true);
usersListGridFilter.setUpdateBuffer(100);
usersClientList= new ListStore<UserClient>();
usersList.add(ClientTestUsers.getUsers());
usersClientListGrid=new Grid<UserClient>(usersClientList, cm);
usersClientListGrid.setStyleAttribute("borderTop", "none");
usersClientListGrid.setAutoExpandColumn("name");
usersClientListGrid.setBorders(true);
usersClientListGrid.setStripeRows(true);
usersClientListGrid.getView().setForceFit(true);
usersClientListGrid.setColumnLines(true);
usersClientListGrid.addPlugin(usersListGridFilter);
usersClientListGrid.setLoadMask(true);
cp = new ContentPanel();
cp.setBodyBorder(true);
cp.setHeadingText("Users");
cp.setButtonAlign(HorizontalAlignment.CENTER);
cp.setLayout(new FitLayout());
cp.setSize(800, 300);
cp.add(usersClientListGrid);
usersListFormPanel = new FormPanel();
usersListFormPanel.add(usersListHorizontalPanel);
usersListFormPanel.add(cp);
usersListFormPanel.setWidth(820);
RootPanel.get("startWindowDiv").add(usersListFormPanel);
答案 0 :(得分:1)
我遇到了同样的问题。
我修补com.extjs.gxt.ui.client.widget.grid.filters.AbstractGridFilters。
我替换:
protected StoreFilter<ModelData> getModelFilter() {
StoreFilter<ModelData> storeFilter = new StoreFilter<ModelData>() {
public boolean select(Store<ModelData> store, ModelData parent, ModelData item, String property) {
for (Filter filter : filters.values()) {
if (filter.isActivatable() && filter.isActive() && !filter.validateModel(item)) {
return false;
}
}
return true;
}
};
for (Filter filter : filters.values()) {
if (!filter.isActivatable() || !filter.isActive()) {
return null;
}
}
return storeFilter;
}
通过
protected StoreFilter<ModelData> getModelFilter() {
StoreFilter<ModelData> storeFilter = new StoreFilter<ModelData>() {
public boolean select(Store<ModelData> store, ModelData parent, ModelData item, String property) {
for (Filter filter : filters.values()) {
if (filter.isActivatable() && filter.isActive() && !filter.validateModel(item)) {
return false;
}
}
return true;
}
};
return storeFilter;
}