$(window).load(function () {
$('#managertable').dataTable({
"bServerSide": true,
"bAutoWidth": true,
"bStateSave": false, //儲存狀態到cookie ******很重要 , 當搜尋的時候頁面一重新整理會導致搜尋的消失。使用這個屬性設定為true就可避免了
"bPaginate": true, // 是否使用分頁
"bProcessing": true, //是否顯示正在處理的提示
"bLengthChange": false, //是否啟用設定每頁顯示記錄數
"iDisplayLength": 20, //預設每頁顯示的記錄數
"bFilter": true, //是否使用搜尋
"bJQueryUI": true, //頁面風格使用jQuery.
// "sScrollY": 200,//豎向捲軸 tbody地區的高度
"sScrollX": "100%", //橫向捲軸
"sScrollXInner": "100%",
"bScrollCollapse": true,
"aoColumns": [{ "sTitle": "Id" },
{ "sTitle": "Name" },
{ "sTitle": "Permission" },
{ "sTitle": "Remarks"}],
"sPaginationType": "full_numbers", //分頁樣式
"bAutoWidth": true, //列的寬度會根據table的寬度自適應
"bSort": false, //是否使用排序
"aaSorting": [[0, "desc"]],
"sAjaxSource": "/action/admin/index.ashx?paraname=admingroupmanager&sub_detail_id=" + $.cookies.get('sub_detail_id')
});
});
下面是ajaxsource響應:
[{"Id":1,"Name":"Administrator 群組","Permission":"100,110,120,130,200,210,220,300,310,320,330,400,410,420,430,500,510,520,600,610,620,630,631,632,633,634,640,700,710,720,730,740,800,810,820,830","Remarks":""}]
綁定不上:var aData = _fnGetObjectDataFn( oSettings.sAjaxDataProp )( json ); //這裡的json是有響應的資料
for ( var i=0, iLen=aData.length ; i<iLen ; i++ )
這裡aData擷取到的是:undefined; 這裡解決了,
現在出現這個問題:
Showing 1 to NaN of NaN entries (filtered from NaN total entries)
DataTables warning (table id = 'managertable'): Requested unknown parameter '0' from the data source for row 0