This seems simple but I haven’t found a solution after much searching. I have a Job model which refers to printing jobs. Among its attributes is a ‘status’ attribute that could be ‘new’, ‘on_press’ or ‘complete’. What I would like to on the job/admin page is to view every job where the status is not ‘complete’ without having to type in this condition into the filters at the top of the grid.
I’m guessing that I have to add the condition to the search function in Job model, but I’m not clear on the correct way to do this.
I created the scope “current” in the Job model. If I replace $model=new Job(‘search’); with $model=Job::model()->current()->findAll(); in job/controller I get an array to string conversion error.
I am using the admin action and tried using the code above replacing ‘index’ with ‘admin’. It would load the page with <>“complete” already in the filter box at the top of the grid but the filter was not applied. I took out the double quotes which put <>complete in the box which works if I type it in that way but does not work on page load.
Thank you, this worked for me. I was thinking I could find a way to express a negative condition but I don’t have many options so the || operator between all the positive options is fine.