Datatable requested unknown parameter '2' from data source row 0
Datatable requested unknown parameter '2' from data source row 0
Hello I'm having issues trying to show data from my DB, I can show each data from the table in my DB but when I try to show all in a table it gives the error in the title, I don't know why. I'm using codeigniter.
This is the controller function
public function datatable()
{
$this->datatables->select('name', 'user_id', 'last_name','identify','contact','rol_type')
->unset_column('user_id')
->add_column('actions', get_buttons('$1','users'),'user_id')
->from('users')
->where(array('user_status'=>'1'));
echo $this->datatables->generate();
}
User_id is an autoincrement variable.
This is the view page.
<?php
//set table id in table open tag
$tmpl = array ( 'table_open' => '
<
table id="big_table" border="1" cellpadding="2" cellspacing="1" class="mytable">' );
$this->table->set_template($tmpl);
$this->table->set_heading('Name','Last Name','Identify Card','Contact Number','Rol assign,'Actions');
echo $this->table->generate();
<?php
>
?>
$(document).ready(function() {
var oTable = $('#big_table').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": '<?php echo base_url(); ?>users/datatable',
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"iDisplayStart ":20,
"oLanguage": {
"sUrl":'<?php echo base_url(); ?>users/translate'
},
"fnInitComplete": function() {
//oTable.fnAdjustColumnSizing();
},
'fnServerData': function(sSource, aoData, fnCallback)
{
$.ajax
({
'dataType': 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : fnCallback
});
}
} );
} );
</script>
I use the datatable code for other functions on my program and it works, and even showing more than 4 data selected.
The data I'm showing it has integer, and strings.