PDA

View Full Version : Storefilter with LiveGridView.



ghinnant
5 Jan 2011, 9:36 AM
My storefilter was working fine on my grid.

Then I changed to use the Live Grid View, and now the store filter does not seem to work. If I scroll my grid or sort by one of the columns the grid updates correctly based on the store filter.

Any suggestion?

Thanks

ghinnant
6 Jan 2011, 1:08 PM
Updating question with code snip:



final RegisterServiceAsync userService = GWT.create(RegisterService.class);
RpcProxy<PagingLoadResult<AllUsers>> proxy = new RpcProxy<PagingLoadResult<AllUsers>>() {
@Overrride
protected void load(Object loadConfig, AsyncCallback<pagingLoadResult<AllUsers>> callback) {
userService.getAllUserInfo((PagingLoadConfig)loadConfig, callback);
}
}
final PagingLoader<PagingLoadResult<AllUsers>> loader = new BasePagingLoader<PagingLoadResult<AllUsers>>(proxy);
loader.setRemoteSort(false);
ListStore<AllUsers> store = new ListStore<AllUsers>(loader);
final PagingToolBar toolBar = new PagingToolBar(16);
toolBar.bind(loader);
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig();
column.setID(AllUsers.USER_ID);
column.setHeader("User ID");
column.setWidth(10);
columns.add(column);
ColumnConfig column = new ColumnConfig();
column.setID(AllUsers.DEPARTMENT);
column.setHeader("Department");
column.setWidth(30);
columns.add(column);
final ColumnModel columnModel = new ColumnModel(columns);
//This is the Filter for the Departments
StoreFilterField<AllUsers> filter = new StoreFilterField<AllUsers>() {

@Override
protected boolean doSelect(Store<AllUsers> store, AllUsers parent, Allusers record, String property, String filter){
String name = parent.get(AllUsers.DEPT_NAME);
name = name.toLowerCase();
if(name.indexOf(filter.toLowerCase()) != -1) {
return true;
}
return false;
}
filter.setWidth(30);
filter.bind(store);
FieldSet fieldSet = new FieldSet();
fieldSet.setHeading("Department Search");
fieldSet.setHeight(50);
fieldSet.setWidth(300);
fieldSet.add(filter);
final Grid<AllUsers> grid = new Grid<AllUsers> (store, columnModel);
grid.setStateId("MyUserGrid");
grid.setStateful(true);
grid.setLoadMask(true);
grid.setHeight(500);
grid.setBoarders(true);
grid.setStripeRows(true);

LiveGridView liveView = new LiveGridView();
liveView.setEmptyText("There are currently no users");
liveView.setForceFit(true);
grid.setView(liveView);




Again, if I remove the LiveGridView, the grid updates based on the filter fine.