I’m wondering if there’s any way to filter the jQuery component yiiGridView to show only items that do NOT have a certain value, e.g. null or empty string.
I’m trying to implement a checkbox that is supposed to filter the grid view to only show items that are ready for a certain task, which requires a number of attributes to be set (not null or empty).
If there’s no way to do this, what would would be the best way to extend yiiGridView to make it possible?
I’ve looked some at the source code and realized what I probably need to do is add some “hidden” attribute to my model or just some query parameter that my view can handle on the server side using some specialized search method. Does this sound like a good solution to you?
By adding some extra attribute(s) to the model for searching, you can extend the gii-genarated "search()" method to support custom filtering functionality.
You may want to keep your data model clean and light-weighted, then you can consider creating a dedicated model for searching that is extended from the data model. Take a look at the "searchModel" mentioned in the following topic.