PDA

View Full Version : ux.grid.GridFilters local - filter on rendered column



kamil.schvarcz
4 May 2010, 4:53 AM
Hi all,

I try to use ux.grid.GridFilters type String for column with renderer ux.renderer.Combo for show and edit foreign table data, but validateRecord function is build only for value (in my implementation ID) and not for displayed value. In this function its available only record object, but there is no information about renderer value.

Have somebody idea how can I compare this rendered value?

Thanks for any response.

Kamil

Reimius
9 Jul 2010, 12:51 PM
If you always want the rendered value to be what's compared, here's the solution.

Use Ext.override on the Ext.ux.grid.filter.StringFilter object, specifically on validateRecord function, copy that function into the override and then change the line:
var val = record.get(this.dataIndex);

into:
var val = yourRenderFunction(record.get(this.dataIndex));

where yourRenderFunction is whatever function you are using to render the data.

If you don't always want this to be the case, add an extra option to the config and then check for it in this function using the same override method above, and do the checks for filtering based on this conditionional logic instead.

Make sure to include your function within the override call.