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 tensorflow
  • ¥15 densenet网络结构中,特征以cat方式复用后是怎么进行误差回传的
  • ¥15 STM32G471芯片spi设置了8位,总是发送16位
  • ¥15 R语言并行计算beta-NTI中tree文件的类型
  • ¥15 如何解读marsbar导出的ROI数据?
  • ¥20 求友友协助弄一下基于STC89C52单片机的声光控制灯原理图
  • ¥15 arduino双向交通灯设计
  • ¥15 有没有会粒子群算法的大能(○゜ε^○)求带不会出收敛图😭
  • ¥15 Matlab读取根元素出错