[eluser]UdayD[/eluser]
hi!
i am using the pagination with ajax
and have written following controller
Code:
<? class My_data_page extends Controller{
function My_data_page(){
parent::Controller();
$this->load->helper('url');
$this->load->library('table');
$this->load->helper('html');
$this->load->library('Ajax_pagination');
$this->load->Model('data');
}
function index(){
$data['makeColumns'] = $this->makeColumns();
$data['getTotalData'] = $this->data->getTotalData();
$data['perPage'] = $this->perPage();
$this->load->view('my_data_page', $data);
}
//Pull 'name' field records from table 'contact'
function perPage(){
return 10; //define total records per page
}
//Generate table from array
function makeColumns(){
if(isset($_POST['page']))
$page=$_POST['page'];
else
$page=0;
$peoples = $this->data->getData($page,10);
//print_r($peoples[1]->countries_name);
//exit();
$counter=count($peoples);
for($i=0;$i<$counter;$i++)
{
$data[]="<div class='mylink' id=".$peoples[$i]->countries_id." style='color:#ff0000;cursor:pointer'>".$peoples[$i]->countries_name."</div>";
}
return $this->table->make_columns($data, 1);
}
}
?>
if you see that in make columns function i am writting div and assigning its id to country id and class to' mylink'
in views it displayed the records but it does not fire the click event written on class mylink using jquery..
code for view
Code:
[removed][removed]
[removed]
$(function(){
$('.mylink').click(function(){
alert($(this).attr('id'));
});
});
[removed]
<div id="content">
<?
$config['first_link'] = 'First';
$config['div'] = 'content'; //Div tag id
$config['base_url'] = 'my_data_page';
$config['total_rows'] = $getTotalData;
$config['per_page'] = 10;
$config['postVar'] = 'page';
$this->ajax_pagination->initialize($config);
//PRINT TABLE
print $this->table->generate($makeColumns);
print $this->ajax_pagination->create_links();
?>
</div>
i want to alert the id when some one clicks on some country.
Please help me out with this.
regards
Uday