简体   繁体   English

日期范围搜索atk4

[英]date range search atk4

i want to do a search of range date using quicksearch item, but until now i realize that in the class quicksearch is a line with this code : 我想使用quicksearch项目进行范围日期搜索,但是直到现在我才意识到在类quicksearch是使用以下代码的一行:

$this->search_field=$this->addField('line','q','')->setNoSave(); $ this-> search_field = $ this-> addField('line','q','')-> setNoSave();

the only thing i did is to change into this: 我唯一要做的就是更改为:

$this->search_field=$this->addField('DatePicker','a','Desde :')->setNoSave(); $ this-> search_field = $ this-> addField('DatePicker','a','Desde:')-> setNoSave();

I just change "line" to "DatePicker", so simple i guess,now if i add a quick search to my manager page has 2 icons, one with the icon search and the other with icon calendar, so if i search a date, i just select the date and hit the icon search, and gets me the all the results with that date, tha´ts perfect, but what happen if I add 2 quicksearchs and try to do a range date search?? 我只是将“ line”更改为“ DatePicker”,所以我想很简单,现在,如果我向经理页面添加快速搜索有2个图标,一个带有图标搜索,另一个带有图标日历,所以如果我搜索日期,我只选择日期并单击图标搜索,即可获得该日期的所有结果,这很完美,但是如果我添加2个快速搜索并尝试进行范围日期搜索,会发生什么情况? the only message i get is "No Records Found". 我收到的唯一消息是“未找到记录”。

So the question is.. How do i do range date search? 所以问题是..我如何进行范围日期搜索? I realize that exists another line in the function postinit: 我意识到函数postinit中存在另一行:

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

maybe it will work if i put another query? 如果我提出另一个查询,也许会工作吗?

$or->where($field>=$v) or something like that?? $ or-> where($ field> = $ v)或类似的东西? i have spend more than 3 days trying to do this range date search? 我已经花费超过3天的时间来进行此范围日期搜索?

So if anyone has some corrections with this code i would be more than happy 因此,如果有人对此代码进行了一些更正,我将非常高兴

Try this 尝试这个

$or->where(array(
      array($field,'>=',$from_date),
      array($field,'<=',$till_date),
));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM