I'm using the jquery ui simplePagination plugin, and I'm trying to display the number of current record on the page.
I have something like this:
The feature I'm trying to achieve here is the 'Showing 1-15 of 50' ( these are the items on one page and 50 is the total number of items in the json object).
Here is how I implemented the above attached feature using jquery simplepagination:
var items = $("table tbody tr");
var numItems = items.length; //total items
var perPage = 10; //per page
var startindex = 15;
totalPages = ceil(numItems / perPage);
currentPage = ceil(startindex / perPage);
items.slice(perPage).hide();
$(".pagination-page").pagination({
items: numItems,
itemsOnPage: perPage,
cssStyle: "light-theme",
onPageClick: function (pageNumber) {
var showFrom = perPage * (pageNumber - 1);
var showTo = showFrom + perPage;
items.hide().slice(showFrom, showTo).show();
}
});
With the above code I can get the <prev> and <next>
buttons to work and display the records accordingly. However, I'm not able to figure out how can I display the current record range (1-15) using jquery.
That should helps you http://plnkr.co/edit/3elrtkqzChAnHCal9Fg1?p=preview
JS:
HTML :
just add span