[英]Search on Ignited Datatables CodeIgniter
又是我,我需要您的最大幫助:)
我正在研究論文,還有很多工作要做,我做了很多搜索,但仍然沒有找到正確的答案,所以我就在這里。
無論如何,我正在使用Codeigniter和Ignited Datatables顯示我的記錄。 顯示記錄沒有問題,但是“搜索和記錄限制”無效。 我遵循了本教程: http : //www.ahmed-samy.com/php-codeigniter-full-featrued-jquery-datatables-part-1/它的搜索工作正常,我們得到了幾乎相同的代碼。
這是我的:
腳本:
$(document).ready(function(){
var oTable = $('#clientDT').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": 'http://localhost:81/ORPS/client/viewClientsJSON',
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"iDisplayStart ": 10,
"oLanguage": {
"sProcessing": "<img src='http://localhost:81/ORPS/images/loading-icons/loading3.gif'>"
},
"fnInitComplete": function() {
//oTable.fnAdjustColumnSizing();
},
'fnServerData': function(sSource, aoData, fnCallback)
{
$.ajax
({
'dataType': 'json',
'type' : 'POST',
'url' : sSource,
'data' : aoData,
'success' : fnCallback
});
},
} );
});
這是我的控制器:
function viewClientsJSON(){
$clientList = $this->clientmodel->clientDT();
return $clientList;
}
這是我的模型:
function clientDT(){
$this->datatables->select('PersonId, LastName, FirstName, MiddleName')
->where('PersonTypeId', '1')
->where('IsActive', '1')
->add_column('Action', get_buttons('client/viewClient/$1', 'client/editClient/$1', '$1'), 'PersonId')
->from('person');
echo $this->datatables->generate();
}
和我的看法:
<div class="table-responsive addMarginTop">
<table id="clientDT" class="table table-condensed table-striped table-hover">
<thead>
<tr>
<th>ID</th>
<th>Last Name</th>
<th>First Name</th>
<th>Middle Name</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
非常感謝您一直以來的幫助。 :)
您使用的DataTables是什么版本? 如果您使用的是1.10的最新版本,請注意這里有很多更改。
請參閱鏈接“ 數據表-升級1.10” 。 除此之外,我認為不會有任何問題。
如果仍然遇到問題,請嘗試使用Chrome或Firefox 開發人員工具 ,並查看“ Conole”選項卡以獲取可能有助於更深入了解的可能錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.