Example

Recommend this page to a friend!

      JavaScript Table Pagination  >  All threads  >  Example  >  (Un) Subscribe thread alerts  
Subject:Example
Summary:example
Messages:11
Author:Stefan Drugda
Date:2015-10-27 12:29:27
 
  1 - 10   11 - 11  

  1. Example   Reply   Report abuse  
Picture of Stefan Drugda Stefan Drugda - 2015-10-27 12:29:27
How to do it, please?
I need an example ...
thank you

  2. Re: Example   Reply   Report abuse  
Picture of Jackson Knowlton Jackson Knowlton - 2015-10-27 13:14:45 - In reply to message 1 from Stefan Drugda
Sorry, I didn't have time to put up an example yesterday, and I expected to have plenty of time before it was approved... I'm not used to my packages being approved so quickly.

There is an example up now.
Very soon, I'm going to put up an example using some of the more advanced features of TablePagination. Hopefully this package is useful.


  3. Re: Example   Reply   Report abuse  
Picture of Zaghdoudi Chokri Zaghdoudi Chokri - 2015-10-28 13:14:59 - In reply to message 1 from Stefan Drugda
Hello
In the file example Just include the file jquery.js and tablePagination.class.js.
Then, edit (if (createButtons !== false)).
Must be replaced with :
if (createButtons !== false) {
$table.after('' +
'<span style="color: blue; cursor: pointer;" class="TablePagination_previous">previous</span>' +
'&nbsp; | page <span class="TablePagination_currentPage">' + currentPage + '</span> | &nbsp;' +
'<span style="color: blue; cursor: pointer;" class="TablePagination_next">next</span>' +
'<br>Page <span class="TablePagination_currentPage">' + currentPage + '</span>' + ' of ' + count + '');
}

  4. Re: Example   Reply   Report abuse  
Picture of Zaghdoudi Chokri Zaghdoudi Chokri - 2015-10-28 13:17:34 - In reply to message 3 from Zaghdoudi Chokri
Thank's Jackson Knowlton :)

  5. Re: Example   Reply   Report abuse  
Picture of Stefan Drugda Stefan Drugda - 2015-10-28 17:11:57 - In reply to message 1 from Stefan Drugda
not works...

  6. Re: Example   Reply   Report abuse  
Picture of Zaghdoudi Chokri Zaghdoudi Chokri - 2015-10-29 06:22:17 - In reply to message 5 from Stefan Drugda
Include :

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

and:

<script type="text/javascript" src="tablePagination.class.js"></script>


  7. Re: Example   Reply   Report abuse  
Picture of Zaghdoudi Chokri Zaghdoudi Chokri - 2015-10-29 06:25:27 - In reply to message 5 from Stefan Drugda
<!DOCTYPE html>
<html>
<head>
<title>Example of TablePagination</title>
<style type="text/css">
table{
border: 1px solid black;
border-collapse: collapse;
color: #202020;
width: 37%;
}
table td{
padding: 5px;
border: 3px solid orange;
font-weight:bold;
}
.TablePagination_next,.TablePagination_previous{
color: orange;
cursor: pointer;
padding: 1.5px;
background-color: #eee;
}
.TablePagination_currentPage{
color: #c00;
font-weight:bold;
}
</style>
<script type="text/javascript" src="jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="tablePagination.class.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(function() {
var paginate = new TablePagination();
//......element(s), rows/page, starting page
paginate.init('#dataTable', 10, 1);
});

function TablePagination() {
var $table;
var currentPage = 1;

this.init = function(ptr, count, startPage, createButtons) {
var obj = this;

if (typeof ptr == "string") {
$table = $(ptr);
} else if (typeof ptr == "object") {
$table = ptr;
}

if (startPage != undefined && parseInt(startPage) > 0) {
currentPage = startPage;
}

if (createButtons !== false) {
$table.after('' +
'<p id="pagination"><span class="TablePagination_previous">previous</span>' +
'&nbsp; | page <span class="TablePagination_currentPage">' + currentPage + '</span> | &nbsp;' +
'<span class="TablePagination_next">next</span>' +
'<br>Page <span class="TablePagination_currentPage">' + currentPage + '</span>' + ' of ' + count + '</p>');
}

$('.TablePagination_previous').click(function() {
if (currentPage > 1) {
currentPage--;
obj.show(currentPage);
$('.TablePagination_currentPage').text(currentPage);
}
return false;
});
$('.TablePagination_next').click(function() {
if (currentPage < $table.find('tr').length / count) {
currentPage++;
obj.show(currentPage);
$('.TablePagination_currentPage').text(currentPage);
}
return false;
});

obj.makePages(count);
obj.show(currentPage);
};

this.makePages = function(count) {
var i = 0;
$table.find('tr').each(function() {
if ($(this).index() % count == 0) {
i++;
}
$(this).addClass('TablePagination_page' + i);
});
};

this.show = function(page) {
$table.find('tr').hide();
$('.TablePagination_page' + page).show();
};
}
});
</script>
</head>
<body>
<h2>Example of Base Functionality using TablePagination</h2>

...............
...............
.................

  8. Re: Example   Reply   Report abuse  
Picture of Stefan Drugda Stefan Drugda - 2015-10-29 11:59:49 - In reply to message 7 from Zaghdoudi Chokri
not works...
see you : http://detva.biz/test/pagination_js/example_OK.html

  9. Re: Example   Reply   Report abuse  
Picture of Zaghdoudi Chokri Zaghdoudi Chokri - 2015-10-29 18:54:00 - In reply to message 8 from Stefan Drugda
In your source code replace <script type="text/javascript" src="jquery-1.11.3.min.js"></script>

by

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

It must be connected to the internet at the time of testing the script

or

you need to download the jquery.min.js file

  10. Re: Example   Reply   Report abuse  
Picture of Stefan Drugda Stefan Drugda - 2015-10-29 19:42:33 - In reply to message 9 from Zaghdoudi Chokri
So finally, ok... thank you..

 
  1 - 10   11 - 11