This is a migrated thread and some comments may be shown as answers.

Grid row filter

4 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrés
Top achievements
Rank 1
Andrés asked on 07 Aug 2014, 06:51 PM
Hi!
First off, I'd like to say that it's fantastic that you implemented this. Out of the box it works quite well, congrats!

That said, there are 2 things that I'd like to accomplish.

-Simpler boolean filter with a tristate checkbox. I already have this partly done, here's what I've got so far:
http://jsbin.com/gifaf/2/edit

I need help figuring out how to a) not show the "remove filter button" b) let the filter know that the "null" value in the input means "remove filter".
This would be really helpful because that way you can make the column really narrow and retain filtering capabilities.

-Filter box autosize. Ideally the input should have the width of the column (as much as possible, with a min-width probably). The default size is too large for narrow columns and it could be much larger when the column is wide. Can you think of any straightforward way of doing this?

Thanks!

4 Answers, 1 is accepted

Sort by
0
Andrés
Top achievements
Rank 1
answered on 07 Aug 2014, 08:36 PM
I made some progress on the tristate checkbox filter:
http://jsbin.com/gifaf/4/edit
It works perfect in firefox, not sure why it takes the opposite value in chrome, looks like change gets triggered before the actual value mutates?

Still can't figure out how to hide the "remove filter" button.
0
Andrés
Top achievements
Rank 1
answered on 08 Aug 2014, 06:49 PM
Got it! http://jsbin.com/gifaf/5/edit

It was hard to get right because different browsers handle events differently, that's why I decided using a second input. Firefox triggers click then change and chrome does it the other way around. After much tinkering I came up with this alternative, all you need to do is have the js in there and set the template for the filter cell in the column config. Hope it helps!
0
Randall
Top achievements
Rank 1
answered on 09 Aug 2014, 06:26 PM
Great work!

Quick question though. How would one go about setting the Initial Filter State to either True or False, instead on null?
0
Andrés
Top achievements
Rank 1
answered on 09 Aug 2014, 07:05 PM
I'd probably set up the tristateCheckbox method to take the initial value as a param instead of just defaulting to null... And either trigger the change in the other input immediately or add the filter to the datasource manually.
Tags
Grid
Asked by
Andrés
Top achievements
Rank 1
Answers by
Andrés
Top achievements
Rank 1
Randall
Top achievements
Rank 1
Share this question
or