ListGrid and Filter

Hi,

I am doing a custom filter for ListGrid so i use the function filterData()/fetchData like this :

TextItem searchCriteria = new TextItem("criteria");
		searchCriteria.setHeight(20);
		searchCriteria.setTitle("Filter");

		searchCriteria.addKeyPressHandler(new KeyPressHandler() {
			public void onKeyPress(KeyPressEvent event) {
				if (event.getKeyName().equals("Enter")) {
					Tab tab = Gtunes.this.tabSet.getSelectedTab();
					((ListGrid) tab.getPane()).fetchData(new Criteria(form
							.getValueAsString("criteria"), form
							.getValueAsString("searchType")));
					((ListGrid) tab.getPane()).redraw();
					SC.say(((ListGrid) tab.getPane()).getFieldName(0));
				}
			}
		});

This do nothing. However, the form values are okay. Is the listgrid not refresh ? or something else ?

Thanks.

Please use the Dev Console to examine the request or see any warnings. Use fiddler or firebug to examine that the request data is correct, and that your server is returning the correct data.

Try simplifying your sample and add a direct call to ListGrid.fetchData. If you’re still having problems, please post your DataSource definition as well as the request / response data when the fetchData call is made.

Sanjiv

I don’t use DataStore, but i store directly ListRecords with setData(). It’s a problem in order to filter ?

Thanks for help.

fetchData() / filterData() require a DataSource. If you already have the data loaded you can create a clientOnly DataSource from it.

Thanks, it works well :slight_smile: