Reputation: 8973
Following is my pagination code using dataTable plugin of jQuery. This code yields an extra page number in the end.
$('#example').DataTable({
"pagingType": "full_numbers",
fnCreatedRow: function (nRow, aData, iDataIndex) {
$("#example").find("td").addClass("ellipsis");
var progressId = "#progressbar" + iDataIndex;
$(progressId).progressbar({
value: 37
});
},
dom: '<"top"iflp<"clear">>rt',
processing: true,
serverSide: true,
order: [[2, "asc"]],
language: {
"emptyTable": "<div class='TabletextRow' style='margin-left:6% !important'><div class='Icon-Nodata'></div> <div class='TableNodataText' style='margin-top:1% !important'> No Records Found.</div>",
"loadingRecords": "Loading...",
"aria": {
"sortascending": ": activate to sort column ascending",
"sortdescending": ": activate to sort column descending"
},
"paginate": {
"first": "First",
"last": "Last",
"next": ">>",
"previous": "<<"
},
}
For. eg: We have 120 records and each page show 10 records. But we can see 12th page index in the UI i.e last page index. How I can remove that?
Upvotes: 3
Views: 1850
Reputation: 58890
CAUSE
If you have 120
records, there will be page 12
that will contain records from 111
through 120
.
Apparently you have applied custom styling to the pagination. In the default style between page 5
and 12
there is also ellipsis (...
) element. Most likely your CSS rules hide this element.
See this jsFiddle for code and demonstration.
SOLUTION
Correct your CSS rules to show ellipsis (...
) characters.
Alternatively, see my answer on how to remove ellipses or article jQuery DataTables – Pagination without ellipses.
Upvotes: 2