Could someone please explain how the filterSelector property of CGridView works (perhaps with an example)? I understand that filterSelector is meant to allow you to specify the JQuery selector that jquery.yiigridview.js uses to identify filter fields, so that you can use additional external form fields and have them work the same way the internal search fields work. However, I’ve looked at the (very sparse) documentation, I’ve read every thread that references filterSelector, and I still don’t get it. Specifically, how does CGridView know which attribute/column you are trying to filter with your external form element?
I’ve tried everything I can think of, and I can’t get it to work.
I was having the same confusion with trying to figure out how to get the filterSelector attribute to work. I got something working, so thought i’d post incase it can help others that end up here looking for answers like I did. I found that I could set a filter selector, but since the default filters inputs were being rendered, my custom filter input was not working. What I ended up doing was extending the CGridView class and altering the renderFilters method to check for a new constant so I could exclude the defaults.
class GridView extends CGridView
public function init()
public function renderFilters()
Then when I want to render the GridView widget, I pass in the filterSelector as well as a filterPosition set to ‘hide’. After that, I can insert my textfield where ever and it will work. So my view looks something like
Now you can search by fields available within the ‘advanced search’ form, and additionaly filter using the filters available within the grid. Normally the filters within the grid will discard the ‘advanced search’.