开发者

GridView and filtering using a lookup table

开发者 https://www.devze.com 2023-03-18 02:35 出处:网络
I\'m using a lookup table as described in the blog tutorial. So one of my grid columns looks like this:

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:

  1. You write the desired status code
  2. Somehow you pass that number to $data->status
  3. Lookup searches an item with that status as status (just like the id)
  4. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消