0
votes

I'm using gxt 3.0.1 and I have Basic Grid added on my form. Now I've added filter for each column which can be used over TextBox in menu of grid columns (basically it's Filter Grid now). I have to make my own TextBox above grid and apply filter to it. And do that for each column of grid. Filtering is done locally. My idea was to look for code they made for their TextBox and apply it on mine TextBox. But I failed. It should be just String filter, which should work exactly as filter provided in Filter Grid. Also I'm using UiBinder.

1
So you failed to find any code that someone else has already made? Is this really a question? Show us the code you used to try and make this work.Scott Solmer
Well it's in gxt-3.0.1.jar, probably, in AbstractGridFilters class, package com.sencha.gxt.widget.core.client.grid.filters, but I don't think it's that easy. To add filter to columns, you just need to do this GridFilters<Stock> filters = new GridFilters<Stock>(); filters.initPlugin(grid); filters.setLocal(true); filters.addFilter(nameFilter); now what happens later is mystery to me.user2061807

1 Answers

1
votes

From the GridFilters javadoc

* Filtering is adjusted by the user using the grid's column header menu (this
* menu can be disabled through configuration). Through this menu users can
* configure, enable, and disable filters for each column.

This is meant to be used to configure column header menus to have filters built in, not set up text boxes outside of the grid - see http://www.sencha.com/examples/#ExamplePlace:filtergrid for how this is intended to work.

To build the way you are describing, start instead with making a StoreFilter object based on the contents of the TextBox, adding it to the store, and re-applying the filter each time the contents of the text box change.

Check out StoreFilterField for a working example, or follow the above instructions to build your own.

If this doesn't work, please provide a code sample in your question...