GridView and filtering using a lookup table
I'm using a lookup table as described in the blog tutorial. So one of my grid columns looks like this:
array(
'name'=>'status',
'value'=>'Lookup::item("PostStatus",$data->status)',
),
If I type "Published" in the Gii generate开发者_如何学Pythond CRUD filtering system I get nothing. If I type the status code, like 1, I get the correct results.
How can I fix this? I mean I need to be able to type "Published" or "Draft" instead of 1 and 2.
You should provide more information like @Sukumar suggested, however I have kind of a supposition: if status is a number and you are directly writing down that number, I think something like this could be happening:
- You write the desired status code
- Somehow you pass that number to $data->status
- Lookup searches an item with that status as status (just like the id)
- Yii gets that number and returns a PostStatus given by that id.
I'm not used to that Lookup::item function, but you should find the way to pass inside the function the statusname
(I don't know how you call its name).
I'm sorry, but that's all I can find with that amount of information. I hope it helps
精彩评论