Reputation: 1876
I am pretty new to jQuery DataTables. I am looking out for a pagination where I display only the numbers and not options like Previous, Next, etc. I tried this but it didn't work.
$("#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;
}
});
Upvotes: 1
Views: 11960
Reputation: 58880
Starting jQuery DataTables 1.10.8 it is possible to use pagingType: 'numbers'
to display page numbers only.
var table = $('#example').DataTable({
pagingType: 'numbers'
});
See this example for code and demonstration.
Upvotes: 1