【问题标题】:how to search the grid with the exact phrase?如何使用确切的短语搜索网格?
【发布时间】:2013-09-21 04:11:41
【问题描述】:

此代码使用 %like% 进行搜索。我们如何定义搜索确切的短语?

 $c->grid->addQuickSearch(array('status',"name"));

例如,如果我们在网格中有 (1,12,13)​​,并且我们搜索“1”,我只想显示 1。

【问题讨论】:

    标签: atk4


    【解决方案1】:

    将该类复制到您的项目库中

    https://github.com/atk4/atk4/blob/master/lib/QuickSearch.php#L99

    并更改第 116 行

    $or->where($field, 'like', $v);
    

    您可以更改新课程的名称并同时使用它们 - 原始的和新的。 要定义要使用的 QuichSearch 设置类名:

    $grid->addQuickSearch($fields,'NewQuickSearch');
    

    https://github.com/atk4/atk4/blob/master/lib/Grid/Advanced.php#L129

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-26
      • 2015-10-19
      • 2022-01-20
      • 2015-12-25
      • 1970-01-01
      • 2016-06-14
      • 1970-01-01
      相关资源
      最近更新 更多