你好,我的分页器有一点问题,我想使用一些自定义的SQL请求,但每次我点击一个分页器链接,它加载我的模型没有自定义请求
我在通过GET方法发送的表单上输入信息:
$view->grid->js()->reload(array("From" =>
$form->get("From"),"To" => $form->get("To"),"SSID" => $form->get("SSID")))
->execute();在我看来,我有:
$this->request=$this->api->db->dsql();
$this->grid=$this->add('Grid');
$this->grid->setModel('Systemevents',array('ID','ReceivedAt','Message'));
$this->grid->addPaginator(10);
if (isset($_GET["SSID"])) {
$this->ssid = $_GET["SSID"];
}
if (isset($_GET["From"])) {
$this->from = $_GET["From"];
}
if (isset($_GET["To"])) {
$this->to = $_GET["To"];
}
$this->grid->dq->where($this->requette->expr('Message like "%.% '
. $this->ssid . ' % src=%"'))
->where($this->requette->expr("ReceivedAt >= '".$this->from. "'
AND ReceivedAt <= '".$this->to."'"));问题是,当我使用分页器更改页面时,where条件消失了。
发布于 2013-04-29 22:47:37
最后,最终的解决方案是:
if ((isset($_GET["SSID"])) || (isset($_GET["From"])) || (isset($_GET["To"]))) {
//GET Method from Recherche.php
$this->ssid = ($_GET["SSID"] == "null" ? null : $_GET["SSID"]);
$this->api->stickyGET("SSID"); // the solutiuon is here
$this->from = ($_GET["From"] == "null" ? null : $_GET["From"]);
$this->api->stickyGET("From"); // <===== the solutiuon is here
$this->to = ($_GET["To"] == "null" ? null : $_GET["To"]);
$this->api->stickyGET("To"); // <===== the solutiuon is here
}发布于 2013-04-25 15:39:25
我没有为我的问题找到任何解决方案,所以我做了一些不同的事情
我在网格中添加了两个按钮,这两个按钮允许我更改sql请求的限制。
如果限制为0,则上一个按钮将隐藏。
现在我必须找到如何计算行数(select count('ID') from 'SystemEvents‘where....)。并将其存储在一个变量中。
https://stackoverflow.com/questions/16174438
复制相似问题