如何使用 pjax 实现 Codeigniter 默认分页
How to Implement Codeigniter Default pagination with pjax
我想用 codeigniter 实现 Pjax jquery 库 其他功能工作正常。但是当我添加它时,它值得分页并且它不起作用。当我点击分页按钮而不是它的变化时 url 但在它重新加载后突然 php 而不是 ajax..
$this->load->library('pagination');
$FilterData = $this->input->get();
$config = bootstrapPagination();
$config['base_url'] = main_url('members');
$config["total_rows"] = $this->member->browse_search_total($FilterData);
$config["per_page"] = PER_PAGE;
$config['reuse_query_string'] = TRUE;
$this->pagination->initialize($config);
$data["links"] = $this->pagination->create_links();
$data['members'] = $this->member->browse_search($FilterData, PER_PAGE, $offset);
$this->pagination->initialize($config);
$data['links'] = $this->pagination->create_links();
if (isset($_SERVER['HTTP_X_PJAX']) && $_SERVER['HTTP_X_PJAX'] == TRUE)
{
$this->load->view('show_members', $data);
} else
{
$this->output->set_template('frontend');
$this->output->set_title('Members | ' . sitename());
$this->load->view('show_members', $data);
}
试试下面的配置值
$config['page_query_string'] = TRUE
怎么才能得到$config["total_rows"]
??
我觉得应该$config["total_rows"] = $this->member->browse_search_total($FilterData)->num_rows();
我解决了这个问题:
$.pjax.defaults.timeout = 3000;
我想用 codeigniter 实现 Pjax jquery 库 其他功能工作正常。但是当我添加它时,它值得分页并且它不起作用。当我点击分页按钮而不是它的变化时 url 但在它重新加载后突然 php 而不是 ajax..
$this->load->library('pagination');
$FilterData = $this->input->get();
$config = bootstrapPagination();
$config['base_url'] = main_url('members');
$config["total_rows"] = $this->member->browse_search_total($FilterData);
$config["per_page"] = PER_PAGE;
$config['reuse_query_string'] = TRUE;
$this->pagination->initialize($config);
$data["links"] = $this->pagination->create_links();
$data['members'] = $this->member->browse_search($FilterData, PER_PAGE, $offset);
$this->pagination->initialize($config);
$data['links'] = $this->pagination->create_links();
if (isset($_SERVER['HTTP_X_PJAX']) && $_SERVER['HTTP_X_PJAX'] == TRUE)
{
$this->load->view('show_members', $data);
} else
{
$this->output->set_template('frontend');
$this->output->set_title('Members | ' . sitename());
$this->load->view('show_members', $data);
}
试试下面的配置值
$config['page_query_string'] = TRUE
怎么才能得到$config["total_rows"]
??
我觉得应该$config["total_rows"] = $this->member->browse_search_total($FilterData)->num_rows();
我解决了这个问题:
$.pjax.defaults.timeout = 3000;