我有基于ajax的分页,我使用了不同的数据表和不同的设置和变量名称,当我更改页面并创建数据表时,它将是不同的功能。
例如:一个表有bFilter:false,第二个表有bFilter:true,但第二个表中没有搜索过滤器框。
我该如何解决这个问题?
第二张表的代码如下:
var videoListDataTable = videoListTable.dataTable({
"bProcessing": true,
"bServerSide": true,
"bFilter": true, "bRetrieve": true,
<?php if (isset($forRelation)): ?>
"bLengthChange": false,
"bInfo": false,
<?php endif; ?>
"sAjaxSource": "video/tableData",
"oLanguage": BIP.dataTableLocalization,
"fnServerData": function (sSource, aoData, fnCallback, oSettings) {
oSettings.jqXHR = $.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
},
"aoColumns": [
{"sTitle": "Id", "mData": "id", "bSortable": false},
{"sTitle": "Video Başlığı", "mData": "title", "bSortable": false},
{"sTitle": "Açıklama", "mData": "description", "bSortable": false},
{"sTitle": "Thumbnail", "mData": "cdn_thumbnail", "bSortable": false,"fnRender":function(obj){
// debugger;
var sReturn = obj.aData["cdn_thumbnail"]
var returnButton = "<img src='"+sReturn+"' height='25px' width='60px'/>";
return returnButton;
}},
{
"sTitle": "Seçim",
"sClass": "text-centered",
"mData": null,
"bSortable": false,
"fnRender": function (obj) {
var sReturn = obj.aData[ obj.iDataColumn ];
var returnButton = "<input class='btn blue' type='button' style='float: right' onclick='BIP.video.table.videoSelectedForRelation(this);return false;' name='" + sReturn + "' value='Seç'></input>";
return returnButton;
},"sWidth": "25%"
},
{
"sTitle": "Düzenle",
"sClass": "text-centered",
"mData": null,
"bSortable": false,
"fnRender": function (obj) {
var sReturn = obj.aData[ obj.iDataColumn ];
var returnButton = "<input class='btn blue' type='button' style='float: none' onclick='BIP.video.detailClickedFromTable(this);return false;' name='" + sReturn + "' value='Düzenle'></input>";
return returnButton;
},"sWidth": "25%"
}
],
"fnCreatedRow": function( nRow, aData, iDataIndex ) {
$(nRow).attr("id","video_table_video_id_"+aData["id"]);
}
});
答案 0 :(得分:0)
我发现了问题。我的朋友扩展了dataTable,这个扩展破坏了dataTable。
问题是
$.extend(true, $.fn.dataTable.defaults, {
"sDom": "<'collapse'<'row-fluid'<'span6'l><'span6'f>r>>t<'row-fluid'<'span6'i><'span6'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page"
}
});