0
我正在使用數據表和通過ajax加載數據。該表永遠不會有很多行,因此不需要分頁,搜索和排序。除了分頁控件和信息(顯示2個條目中的1到2)仍然可見以外,下面的代碼工作得很好。我曾嘗試將「bPaginate」:false添加到表的初始化中,但不會顯示數據。它只是說,「處理」 ...數據表Ajax源代碼
<script type="text/javascript">
$(document).ready(function() {
var dataTable = $('#dataTablecontacts').dataTable({
"bServerSide": true,
"sAjaxSource": "/Contact/GetDataTable/@Model.Id",
"bProcessing": true,
"bFilter": false,
"bSort": false,
"bLengthChange": false,
"aaSorting": [[1, "asc"]],
"aoColumns": [
{ "mData": "Id", "bSearchable": false, "bSortable": false, bVisible: false },
{ "mData": "Name" },
{ "mData": "Position" },
{ "mData": "OfficePhone", "bSearchable": false, "bSortable": false },
{ "mData": "MobilePhone", "bSearchable": false, "bSortable": false },
{ "mData": "Email", "bSearchable": false, "bSortable": false },
{ "mData": "BusinessPartner", "bSearchable": false, "bSortable": false, bVisible: false },
]
});
$("#dataTablecontacts tbody").on("click", "tr", function (event) {
var id = dataTable.fnGetData(this)['Id'];
var viewUrl = "/Contact/Details/" + id;
window.location = viewUrl;
});
});
這不工作,所以我打算將其標記爲答案,但我很好奇爲什麼bPaginate:錯誤導致了我所看到的問題 – user1287453