(function ($) {
$.fn.page = function (PageSize) {
$(this).addClass("page-table")
var tableId = $(this).attr("id");
if (typeof tableId == 'undefined') {
return this;
};
$('.pagination[for="' + tableId + '"]').remove();
if (typeof PageSize == 'number') {
PageSize = parseInt(PageSize);
} else if (typeof PageSize == 'string') {
if ($.isNumeric(PageSize) == true) {
PageSize = parseInt(PageSize);
} else {
PageSize = 10;
}
} else {
PageSize = 10;
}
$(this).after('<ul class="pagination" for="' + tableId + '"></ul>');
var currpage = 1;
var item = 1;
$(this).find('tr:has(td)').each(function () {
$(this).attr('data-page', currpage);