View Full Version : Selectively not rendering rows in GridPanel

30 Jul 2009, 3:48 PM
Hey everyone,

Is there a way to use a custom renderer to selectively decide not to render a row in a GridPanel? Say, for instance, I've got a store full of people, and I really hate the letter 'a', and want to avoid rendering any records where a person's name contains it.

I've got this as a potential column definition:

header: 'First Name',
dataIndex: 'firstname',
renderer: function(value, p, record){
if(record.data.firstname.match(/a/) !== null){
return String.format(
'<span class="firstname">{0}</span>',
}Is there something I could do at ??? that would prevent rendering? Returning false just yields a text-free DOM insertion that still registers mouseover events. I could just hide it, but I'd prefer to not add anything at all if possible.

I'm expecting renderer is the wrong place to be doing this, but ... well, hopefully, someone can point me in the right direction.

30 Jul 2009, 3:51 PM
You're doing the filtering in the wrong spot. You need to filter the data from the store, not choose what to render in the grid.

30 Jul 2009, 4:01 PM
so then, perhaps bind a store.filterBy function call triggered within the gridPanel's 'beforerender' event, or some such?

EDIT: Yes, indeed, that did the trick. Thanks!