数据表请求未知参数'2'从数据源第0行


Datatable requested unknown parameter '2' from data source row 0

你好,我有问题,试图从我的DB显示数据,我可以从我的DB表中显示每个数据,但当我试图在表中显示所有它给出了标题中的错误,我不知道为什么。我正在使用codeigniter。

这是控制器函数

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是一个自增变量。

这是视图页。

<?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();
?>
<script type="text/javascript">
  $(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>

我使用数据表代码在我的程序上的其他功能,它的工作,甚至显示超过4个数据选择。

我展示的数据有整数和字符串。

Datatable version为0.7

公共函数是这样工作的

public function datatable()
{
    //$this->datatables->select('name', 'user_id', 'last_name','identify','contact','rol_type')
    $this->datatables->select('name')
        ->select('last_name')
        ->select('identify')
        ->select('contact')
        ->select('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();
}

我不知道为什么选择必须是这样的,而不是注释的那个。但是它可以固定表格并正确显示。