Using negations in yiiGridView filter

Hi,

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?

Thanks in advance.

Does ajax updating of the grid not satisfy your needs?

That will be handled easier in the server side?

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?

Yep :)

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.

http://www.yiiframework.com/forum/index.php/topic/42874-bring-user-back-to-where-he-was-in-cgridview

It’s an old topic, but deserves much more attention.

Thanks, I’ve solved it now. Interesting link. Although I won’t use it this time I will keep it in mind.