dqc18251 2012-01-19 14:54
浏览 32

Yii CGridView过滤器

I want CGridView's filter to work with multiple words in one column at the time. For example i want to show all rows with "A" in first column plus all the rows with "B" in the same column.

Does anybody know which class and function should i override to do this?

  • 写回答

1条回答 默认 最新

  • dqgg25493 2012-01-19 18:26
    关注

    You will have to modify the search() function in your model. The search() function will have something like this -

        $criteria->compare('your_column_name', $this->your_column_name, true);
    

    you can modify it by breaking the input, which is in $this->your_column_name and adding one compare condition for each of the elements in the input. You can use explode() to break the string into multiple terms.

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器