'How to add first and last in simplepagiantion script?
I have added a pagination using this site https://flaviusmatis.github.io/simplePagination.js/ but not sure how to add first and last link in javascript.
<script>
jQuery(function() {
var items = jQuery("table tbody tr");
var numItems = items.length;
var perPage = 10;
// Only show the first 2 (or first `per_page`) items initially.
items.slice(perPage).hide();
jQuery("#pagination").pagination({
items: numItems,
itemsOnPage: perPage,
cssStyle: "light-theme",
// This is the actual page changing functionality.
onPageClick: function(pageNumber) {
// We need to show and hide `tr`s appropriately.
var showFrom = perPage * (pageNumber - 1);
var showTo = showFrom + perPage;
// We'll first hide everything...
items.hide()
// ... and then only show the appropriate rows.
.slice(showFrom, showTo).show();
}
});
});
</script>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|