Welcome Guest, Not a member yet? Register   Sign In
ajax pagination problem
#1

[eluser]mrcoder[/eluser]
Hi,

I am new to CI. I am trying to implement ajax pagination in ci. ihave followed the steps as per the tutorial.

http://tohin.wordpress.com/2008/10/07/co...guideline/

I am getting the pagination links but when iam clicking the link data is not changing.ie pagination is not working can any one help me.
#2

[eluser]mrcoder[/eluser]
HI dam,

Iam giving the code.can u please tel me whats wrong with my code.


Controler:

<?php
class Test extends Controller {

function test() {
parent::Controller();
$this->load->database();
}

function index($offset = 0)
{
ob_start();
$this->ajax_page( 0 );
$initial_content = ob_get_contents();
ob_end_clean();

$data[‘table’] = “<div id=‘content’>” . $initial_content . “</div>” ;

$this->load->view(‘page’,$data);

}

function ajax_page($offset = 0)
{
$this->load->model(‘model_table’);
$this->load->library(‘Jquery_pagination’);

$config[‘base_url’] = base_url().‘index.php/test/ajax_page/’;
/* Here i am indicating to the url from where the pagination links and the table section will be fetched */

$config[‘div’] = ‘#content’;
/* CSS selector for the AJAX content */

$limit = 5;
$config[‘total_rows’] = $this->model_table->num_rows();
$config[‘per_page’] = $limit;

$this->jquery_pagination->initialize($config);

$this->load->library(‘table’);

$html = $this->jquery_pagination->create_links() . ‘
’ . $this->table->generate($this->model_table->content( $limit, $offset));

echo $html;
}
}
?&gt;


Model:

class Model_table extends Model{

var $tbl_name = ‘specialities’;

function Model_table() {
parent::Model();
}

function num_rows() {
return $this->db->count_all( $this->tbl_name );
}

function content( $limit, $offset ) {
return $this->db->get( $this->tbl_name, $limit, $offset );
}

}


View

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Codeigniter Jquery Ajax Pagination&lt;/title&gt;
[removed][removed]
&lt;/head&gt;
&lt;body&gt;
&lt;?=$table;?&gt;
&lt;/body&gt;
&lt;/html&gt;
#3

[eluser]Dam1an[/eluser]
I've already answered this in your other thread and you even answered to it, so you know I answered it!
And I also explicitly said to use [ code ] tags




Theme © iAndrew 2016 - Forum software by © MyBB