I am having an issue where in selecting multiple members from a jquery datatable from different pages, If I select 2 members from the first page and 2 from the second page, when I go back the the first page the values check boxes are not ticked and the same when I go back to the second page. Same thing happens while searching through the datatable. What could be the issue? I will post my Controller, Model, View, and Datatable JS below:
VIEW:
<div class="col-md-12"><?php echo $this->table->generate(); ?></div>
CONTROLLER:
$tmpl = array ( 'table_open' => '<table id="big_table" border="1" cellpadding="2" cellspacing="1" class="table table-striped">' );
$this->table->set_template($tmpl);
$this->table->set_heading('<input type="checkbox" id="selAll" name="select_all" />','Customer Name','Email','Phone');
MODEL:
public function list_customers($center_id ='',$course_id =''){
$this->datatables->select("customer_id, CONCAT_WS( ' ' , firstname , lastname ) as firstname, email ,phone")->where('is_disable',0)
->edit_column('customer_id', input_checkbox('customer_id[]' ,'$1' ),'customer_id')->from($this->_table_name);
if(!empty($center_id)) $this->db->where('category',$center_id);
if(!empty($course_id)){
$this->db->where('customer_id IN (select customer_id from `dance_customer_course` WHERE dance_customer_course.`festival_id` = '.$course_id.')');
}
return $this->datatables->generate();
}
DATATABLE (JS):
<script type="text/javascript">
$(document).ready(function() {
$("#sform").submit(function(){
if($('.checkbox:checked').length < 1){
alert("Please select the customer");
return false
}
if($('#content').val() == ''){
alert("Please enter content");
return false
}
});
var oTable = $('#big_table').dataTable( {
"bProcessing": true,
"bInfo": false,
"bServerSide": true,
"sAjaxSource": '<?php echo base_url(); ?>sendsms/list_customers',
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"iDisplayStart ":20,
"oLanguage": {
"sProcessing": "<img src='<?php echo base_url(); ?>img/ajax-loader.gif'>"
},
"fnInitComplete": function() {
//oTable.fnAdjustColumnSizing();
},
'fnServerData': function(sSource, aoData, fnCallback)
{
$.ajax
({
'dataType': 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : fnCallback
});
}
});
$('#selAll').click(function(e){
if (e.stopPropagation) e.stopPropagation();
var checkBoxes = $(".checkbox");
if(checkBoxes.prop("checked")) $(this).text("Check All");
else $(this).text("Uncheck All");
checkBoxes.prop("checked", !checkBoxes.prop("checked"));
});
});
This is pretty much the code I have used, Can somebody please help me with this? Thank you.
"bServerSide": false,but it displays only 100 entries out of a possible 2000 entries