我是jQuery DataTables的新手。我正在寻找一个分页,我只显示数字,而不是上一页,下一页等选项。我试过这个,但它没有用。
$("#myCsps").dataTable({
"bFilter": false,
"bInfo": true,
"bProcessing": true,
"sPaginationType": "bootstrap",
"asStripClasses": null,
"oLanguage": {
"sInfo": "Total CSPs: _TOTAL_",
"oPaginate": {
"sNext": "",
"sLast": "",
"sFirst": null,
"sPrevious": null
}
},
//oSearch: { "sSearch": "Type here...", "bRegex": false, "bSmart": false },
"bLengthChange": false,
"aaData": data,
"aoColumns": columnSettings,
"fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
$(nRow).children().each(function(index, td) {
if (index == 7) {
if ($(td).html() === "Schedule0") {
$(td).css("background-color", "#078DC6");
} else if ($(td).html() === "Schedule1") {
$(td).css("background-color", "#FFDE00");
} else if ($(td).html() === "Schedule2") {
$(td).css("background-color", "#06B33A");
} else if ($(td).html() === "Schedule3") {
$(td).css("background-color", "#FF3229");
} else {
$(td).css("background-color", "#FF3229");
}
}
});
return nRow;
}
});
答案 0 :(得分:1)
启动jQuery DataTables 1.10.8可以使用pagingType: 'numbers'
仅显示页码。
var table = $('#example').DataTable({
pagingType: 'numbers'
});
请参阅this example以获取代码和演示。
答案 1 :(得分:0)