首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AgileToolkit -自定义SQL请求+分页器

AgileToolkit -自定义SQL请求+分页器
EN

Stack Overflow用户
提问于 2013-04-24 00:22:48
回答 2查看 89关注 0票数 0

你好,我的分页器有一点问题,我想使用一些自定义的SQL请求,但每次我点击一个分页器链接,它加载我的模型没有自定义请求

我在通过GET方法发送的表单上输入信息:

代码语言:javascript
复制
$view->grid->js()->reload(array("From" => 
  $form->get("From"),"To" => $form->get("To"),"SSID" => $form->get("SSID")))
  ->execute();

在我看来,我有:

代码语言:javascript
复制
  $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条件消失了。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-04-29 22:47:37

最后,最终的解决方案是:

代码语言:javascript
复制
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 

}
票数 0
EN

Stack Overflow用户

发布于 2013-04-25 15:39:25

我没有为我的问题找到任何解决方案,所以我做了一些不同的事情

我在网格中添加了两个按钮,这两个按钮允许我更改sql请求的限制。

如果限制为0,则上一个按钮将隐藏。

现在我必须找到如何计算行数(select count('ID') from 'SystemEvents‘where....)。并将其存储在一个变量中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16174438

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档