【问题标题】:Ignited Datatables Where Not In点燃的数据表不在
【发布时间】:2015-05-12 14:18:40
【问题描述】:

我使用 Ignite Datatables 库,但它不支持 WhereNotIn 功能,如何将此功能添加到该库中?提前致谢。

【问题讨论】:

  • CodeIgniter 确实有这个 API。确保在数据库配置中启用了 active_record(CodeIgniter 2.x) 或 query_builder (CodeIgniter 3.x)。

标签: codeigniter datatables


【解决方案1】:

像这样修补Datatables 类:

class Datatables
{
  //...      
  private $where_not_in       = array();
  //...      

  public function where_not_in($key_condition, $val = NULL, $backtick_protect = TRUE)
  {
    $this->where_not_in[] = array($key_condition, $val, $backtick_protect);
    $this->ci->db->where_not_in($key_condition, $val, $backtick_protect);
    return $this;
  }      

  private function get_total_results($filtering = FALSE)
  {
  //...      
    foreach($this->where_not_in as $val)
      $this->ci->db->where_not_in($val[0], $val[1], $val[2]);
  //...      
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-23
    • 1970-01-01
    • 2014-09-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多