我是新手,正在做我的学校项目。
如果bServerSide设置为false,是否可以对Ignited DataTable进行分页和搜索?如果我设置bServerSide:false,搜索确实有效,但分页不起作用。但我做bServserSide:是的,分页有效,但搜索没有。
我的模特:
function projectDT(){
$this->datatables->select('ProjectId, ProjectName, ProjectLocation, Status')
->add_column('Action', get_buttons('project/viewProject/$1','project/editProject/$1', '$1'), 'ProjectId')
->where ('IsActive',1)
->from('project')
->join('status','status.StatusId=project.StatusId','left');
echo $this->datatables->generate();
}
控制器:
function viewProjectJSON(){
$projectList = $this->projectmodel->projectDT();
return $projectList;
}
JS:
var oTable = $('#projectDT').dataTable( { //#projectDT is the TABLE na atong i-convert to datatable
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": 'http://localhost:81/ORPS/project/viewProjectJSON', //source sa data
"bJQueryUI": false,
"sPaginationType": "full_numbers",
"iDisplayStart ": 10,
"oLanguage" : {
"sProcessing": "<img src='http://localhost:81/ORPS/images/loading-icons/loading3.gif'>"
},
'fnServerData': function(sSource, aoData, fnCallback)
{
$.ajax
({
'dataType': 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : fnCallback
});
},
} );
请帮帮我。谢谢!