페이징 처리 수정

master
mjkhan21 4 months ago
parent 29bf938974
commit 30f211adf0

@ -629,12 +629,14 @@ $.fn.setPaging = function(config) {
config.current = function(index, label) {return '<li class="page-item active"><a class="page-link">{label}</a></li>'.replace(/{label}/, label);}; config.current = function(index, label) {return '<li class="page-item active"><a class="page-link">{label}</a></li>'.replace(/{label}/, label);};
config.next = function(index, label) {return '<li onclick="{func}" class="page-item next"><a class="page-link"><i class="tf-icon bx bx-chevron-right"></i></a></li>'.replace(/{func}/, config.func.replace(/{index}/, label));}; config.next = function(index, label) {return '<li onclick="{func}" class="page-item next"><a class="page-link"><i class="tf-icon bx bx-chevron-right"></i></a></li>'.replace(/{func}/, config.func.replace(/{index}/, label));};
config.last = function(index, label) {return '<li onclick="{func}" class="page-item last"><a class="page-link"><i class="tf-icon bx bx-chevrons-right"></i></a></li>'.replace(/{func}/, config.func.replace(/{index}/, label));}; config.last = function(index, label) {return '<li onclick="{func}" class="page-item last"><a class="page-link"><i class="tf-icon bx bx-chevrons-right"></i></a></li>'.replace(/{func}/, config.func.replace(/{index}/, label));};
return this.each(function(){ return this.each(function(){
let list = config.list, let length = config.list ? config.list.length : config.dataLength,
start = list.empty ? 0 : config.start + 1, empty = length < 1,
end = list.empty ? 0 : config.start + list.length, start = empty ? 0 : config.start + 1,
pagingInfo = list.empty ? "" : start + " ~ " + numberFormat.format(end) + " / " + numberFormat.format(config.totalSize); end = empty ? 0 : config.start + length,
pagingInfo = empty ? "" : start + " ~ " + numberFormat.format(end) + " / " + numberFormat.format(config.totalSize);
$("#"+ config.prefix + "PagingInfo").html(pagingInfo); $("#"+ config.prefix + "PagingInfo").html(pagingInfo);
let tag = paginate(config), let tag = paginate(config),
@ -651,11 +653,13 @@ $.fn.setPaging = function(config) {
$.fn.setPagingInfo = function(config) { $.fn.setPagingInfo = function(config) {
return this.each(function(){ return this.each(function(){
let list = config.list; let length = config.list ? config.list.length : config.dataLength,
let pagingInfo = list.empty ? "" : 1 empty = length < 1,
+ " ~ " pagingInfo = empty ? "" : 1
+ numberFormat.format(list.length) + " ~ "
+ " / " + numberFormat.format(config.totalSize); + numberFormat.format(length)
+ " / " + numberFormat.format(config.totalSize);
$("#"+ config.prefix + "PagingInfo").html(pagingInfo); $("#"+ config.prefix + "PagingInfo").html(pagingInfo);
}); });
} }

Loading…
Cancel
Save