Html
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Salary</th>
<th scope="col">Age</th>
</tr>
</thead>
<tbody class="page-data">
</tbody>
</table>
<nav aria-label="Page navigation example">
<ul class="pagination">
<li onclick="prePage()" class="page-item page-list">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
<span class="sr-only">Previous</span>
</a>
</li>
<li onclick="nextPage()" class="page-item">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">»</span>
<span class="sr-only">Next</span>
</a>
</li>
</ul>
</nav>
JS Code
<script>
let userData = null;
$.ajax({
url: "http://dummy.restapiexample.com/api/v1/employees",
type: "get",
async: false,
success: function(users) {
userData = users.data;
}
});
var currentPage = 0;
let pages = "";
let page_size = 5;
pages = paginate(userData, page_size);
pageLi = "";
pages.forEach((element, index) => {
if (index != 0)
pageLi += '<li onclick="pageChange(' + index + ')" id="page_' + index + '" class="page-item list-item" id="page_' + index + '"><a class="page-link" href="javascript:void(0)">' + index + '</a></li>';
});
$(".page-list").after(pageLi);
page = pages[currentPage];
printRows(page);
function nextPage() {
if (pages.length - 1 > currentPage)
page = currentPage + 1;
pageChange(page);
}
function prePage() {
if (currentPage < pages.length && currentPage != 0)
page = currentPage - 1;
pageChange(page);
}
function pageChange(page) {
currentPage = page;
$(".list-item").removeClass("active");
$("#page_" + page).addClass("active");
$(".page-data").html("");
page = pages[page];
printRows(page);
}
function printRows(arr) {
arr.forEach(element => {
$(".page-data").append("<tr><td>" + element.id + "</td><td>" + element.employee_name + "</td><td>" + element.employee_salary + "</td><td>" + element.employee_age + "</td></tr>");
});
}
function paginate(arr, size) {
return arr.reduce((acc, val, i) => {
let idx = Math.floor(i / size)
let page = acc[idx] || (acc[idx] = [])
page.push(val)
return acc
}, [])
}
</script>
Answer from Azad Education on Stack OverflowBootstrap
getbootstrap.com › docs › 4.0 › components › pagination
Pagination · Bootstrap
Pagination links are customizable for different circumstances. Use .disabled for links that appear un-clickable and .active to indicate the current page. While the .disabled class uses pointer-events: none to try to disable the link functionality of <a>s, that CSS property is not yet standardized and doesn’t account for keyboard navigation. As such, you should always add tabindex="-1" on disabled links and use custom JavaScript to fully disable their functionality.
Bootstrap
getbootstrap.com › docs › 5.3 › components › pagination
Pagination · Bootstrap v5.3
As such, you should always add tabindex="-1" on disabled links and use custom JavaScript to fully disable their functionality. ... <nav aria-label="..."> <ul class="pagination"> <li class="page-item disabled"> <a class="page-link">Previous</a> </li> <li class="page-item"><a class="page-link" href="#">1</a></li> <li class="page-item active"> <a class="page-link" href="#" aria-current="page">2</a> </li> <li class="page-item"><a class="page-link" href="#">3</a></li> <li class="page-item"> <a class="page-link" href="#">Next</a> </li> </ul> </nav>
Videos
06:55
Bootstrap Pagination | Bootstrap 5 Tutorial 40 - YouTube
24:20
How To Make Pagination Using PHP And Bootstrap - YouTube
07:10
Responsive bootstrap table with pagination, search and sorting ...
08:20
How to use Pagination in Bootstrap? - #bootstrap Full Course for ...
03:30
How To Add Pagination In Bootstrap Table? - Next LVL Programming ...
28:58
Pagination in bootstrap| Bootstrap pagination |bootstrap table ...
W3Schools
w3schools.com › bootstrap › bootstrap_pagination.asp
Bootstrap Pagination
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
Bootstrap
getbootstrap.com › docs › 5.0 › components › pagination
Pagination · Bootstrap v5.0
Pagination links are customizable for different circumstances. Use .disabled for links that appear un-clickable and .active to indicate the current page. While the .disabled class uses pointer-events: none to try to disable the link functionality of <a>s, that CSS property is not yet standardized and doesn’t account for keyboard navigation. As such, you should always add tabindex="-1" on disabled links and use custom JavaScript to fully disable their functionality.
Top answer 1 of 2
4
Html
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Salary</th>
<th scope="col">Age</th>
</tr>
</thead>
<tbody class="page-data">
</tbody>
</table>
<nav aria-label="Page navigation example">
<ul class="pagination">
<li onclick="prePage()" class="page-item page-list">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
<span class="sr-only">Previous</span>
</a>
</li>
<li onclick="nextPage()" class="page-item">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">»</span>
<span class="sr-only">Next</span>
</a>
</li>
</ul>
</nav>
JS Code
<script>
let userData = null;
$.ajax({
url: "http://dummy.restapiexample.com/api/v1/employees",
type: "get",
async: false,
success: function(users) {
userData = users.data;
}
});
var currentPage = 0;
let pages = "";
let page_size = 5;
pages = paginate(userData, page_size);
pageLi = "";
pages.forEach((element, index) => {
if (index != 0)
pageLi += '<li onclick="pageChange(' + index + ')" id="page_' + index + '" class="page-item list-item" id="page_' + index + '"><a class="page-link" href="javascript:void(0)">' + index + '</a></li>';
});
$(".page-list").after(pageLi);
page = pages[currentPage];
printRows(page);
function nextPage() {
if (pages.length - 1 > currentPage)
page = currentPage + 1;
pageChange(page);
}
function prePage() {
if (currentPage < pages.length && currentPage != 0)
page = currentPage - 1;
pageChange(page);
}
function pageChange(page) {
currentPage = page;
$(".list-item").removeClass("active");
$("#page_" + page).addClass("active");
$(".page-data").html("");
page = pages[page];
printRows(page);
}
function printRows(arr) {
arr.forEach(element => {
$(".page-data").append("<tr><td>" + element.id + "</td><td>" + element.employee_name + "</td><td>" + element.employee_salary + "</td><td>" + element.employee_age + "</td></tr>");
});
}
function paginate(arr, size) {
return arr.reduce((acc, val, i) => {
let idx = Math.floor(i / size)
let page = acc[idx] || (acc[idx] = [])
page.push(val)
return acc
}, [])
}
</script>
2 of 2
1
I suggest you use bootpag,
It's very simple and works good with bootstrap, it also has good documentation to show you how to use it step by step.
I don't have to explain it here since everything is explained on the website.
I hope this can help you.
Link: http://botmonster.com/jquery-bootpag/#pro-page-8
Jacobmarshall-etc
jacobmarshall-etc.github.io › bootstrap-paginator
Bootstrap Paginator - Bootstrap Pagination jQuery plugin
Bootstrap Paginator is a jQuery plugin that simplifies the rendering of Bootstrap Pagination component. It provides methods to automates the update of the pagination status and also some events to notify the status changes within the component.
Bootstrap
getbootstrap.com › docs › 5.2 › components › pagination
Pagination · Bootstrap v5.2
Pagination links are customizable for different circumstances. Use .disabled for links that appear un-clickable and .active to indicate the current page. While the .disabled class uses pointer-events: none to try to disable the link functionality of <a>s, that CSS property is not yet standardized and doesn’t account for keyboard navigation. As such, you should always add tabindex="-1" on disabled links and use custom JavaScript to fully disable their functionality.
TutorialsPoint
tutorialspoint.com › bootstrap › bootstrap_pagination.htm
Bootstrap - Pagination
In order to create a basic pagination, add the .pagination class to an <ul> element. To each <li> element add the .page-item and a .page-link class to the link inside it. You can edit and try running this code using the Edit & Run option.
React Bootstrap
react-bootstrap.netlify.app › pagination
Pagination | React Bootstrap
import Pagination from 'react-bootstrap/Pagination'; let active = 2; let items = []; for (let number = 1; number <= 5; number++) { items.push( <Pagination.Item key={number} active={number === active}> {number} </Pagination.Item>, ); } const paginationBasic = ( <div> <Pagination>{items}</Pagination> <br /> <Pagination size="lg">{items}</Pagination> <br /> <Pagination size="sm">{items}</Pagination> </div> ); render(paginationBasic); For building more complex pagination UI, there are few convenient sub-components for adding "First", "Previous", "Next", and "Last" buttons, as well as an "Ellipsis" item for indicating previous or continuing results.
W3Schools
w3schools.com › bootstrap4 › bootstrap_pagination.asp
Bootstrap 4 Pagination
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
Esimakin
esimakin.github.io › twbs-pagination
jQuery Pagination plugin
$('.sync-pagination').twbsPagination({ totalPages: 20, onPageClick: function (evt, page) { $('#content').text('Page ' + page); } }); ... It shows how it look like with bootstrap 4 (version 4.0.0-alpha.4).
W3Schools
w3schools.com › bootstrap5 › bootstrap_pagination.php
Bootstrap 5 Pagination
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python, Bootstrap, Java and XML.
GitHub
github.com › markbates › jquery-bootstrap-pagination
GitHub - markbates/jquery-bootstrap-pagination
// Basic usage: $("#my-pagination-section").pagination(); // With options: $("#my-pagination-section").pagination({ total_pages: 10, current_page: 2, callback: function(event, page) { return alert("Page " + page + " was clicked!"); } }); // ...
Starred by 90 users
Forked by 39 users
Languages CoffeeScript 85.8% | Ruby 14.2% | CoffeeScript 85.8% | Ruby 14.2%
Educative
educative.io › answers › how-to-use-bootstrap-pagination
How to use Bootstrap pagination
Line 15: We add the pagination class to the <ul> HTML element and this <ul> wraps every other <li> . The pagination bootstrap class styles the <ul> element.
CoreUI
coreui.io › react › documentation › components › pagination
Bootstrap Pagination - extended examples and tutorials
July 5, 2023 - Pagination links are customizable for different circumstances. Use .disabled for links that appear un-clickable and .active to indicate the current page. While the .disabled class uses pointer-events: none to try to disable the link functionality of <a>s, that CSS property is not yet standardized and doesn’t account for keyboard navigation. As such, you should always add tabindex="-1" on disabled links and use custom JavaScript to fully disable their functionality.
Bootstrap
getbootstrap.com › docs › 4.6 › components › pagination
Pagination · Bootstrap v4.6
Pagination links are customizable for different circumstances. Use .disabled for links that appear un-clickable and .active to indicate the current page. While the .disabled class uses pointer-events: none to try to disable the link functionality of <a>s, that CSS property is not yet standardized and doesn’t account for keyboard navigation. As such, you should always add tabindex="-1" on disabled links and use custom JavaScript to fully disable their functionality.