From 3bbf44e3bf6e3f09ba80cf3f8aa48c8ad24e4596 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Thu, 12 Sep 2024 11:24:53 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=95=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/webapp/resources/js/base/base.js | 27 ++++++++++++++++--- .../resources/js/base/dataset-support.js | 3 ++- src/main/webapp/resources/js/base/dataset.js | 4 +++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/main/webapp/resources/js/base/base.js b/src/main/webapp/resources/js/base/base.js index 25dcc1b..602e334 100644 --- a/src/main/webapp/resources/js/base/base.js +++ b/src/main/webapp/resources/js/base/base.js @@ -630,14 +630,23 @@ $.fn.setPaging = function(config) { config.next = function(index, label) {return ''.replace(/{func}/, config.func.replace(/{index}/, label));}; config.last = function(index, label) {return '
  • '.replace(/{func}/, config.func.replace(/{index}/, label));}; + let containers = config.containers || []; + if ("string" == typeof containers) + containers = containers.split(","); + + let byID = "#" + config.prefix + "PagingInfo", + byName = "[name='" + config.prefix + "PagingInfo']" + selector = (containers.length < 1 ? + [byID, byName] : + containers.map(container => container + " " + byID + "," + container + " " + byName) + ).join(","); return this.each(function(){ let length = config.list ? config.list.length : config.dataSize || config.dataLength, empty = length < 1, start = empty ? 0 : !config.added ? config.start + 1 : 1, end = empty ? 0 : config.start + length, - pagingInfo = empty ? "" : start + " ~ " + numberFormat.format(end) + " / " + numberFormat.format(config.totalSize), - selector = "#"+ config.prefix + "PagingInfo,[name='" + config.prefix + "PagingInfo']"; + pagingInfo = empty ? "" : start + " ~ " + numberFormat.format(end) + " / " + numberFormat.format(config.totalSize); $(selector).html(pagingInfo); @@ -653,14 +662,24 @@ $.fn.setPaging = function(config) { } $.fn.setPagingInfo = function(config) { + let containers = config.containers || []; + if ("string" == typeof containers) + containers = containers.split(","); + + let byID = "#" + config.prefix + "PagingInfo", + byName = "[name='" + config.prefix + "PagingInfo']" + selector = (containers.length < 1 ? + [byID, byName] : + containers.map(container => container + " " + byID + "," + container + " " + byName) + ).join(","); + return this.each(function(){ let length = config.list ? config.list.length : config.dataLength, empty = length < 1, pagingInfo = empty ? "" : 1 + " ~ " + numberFormat.format(length) - + " / " + numberFormat.format(config.totalSize), - selector = "#"+ config.prefix + "PagingInfo,[name='" + config.prefix + "PagingInfo']"; + + " / " + numberFormat.format(config.totalSize); $(selector).html(pagingInfo); }); diff --git a/src/main/webapp/resources/js/base/dataset-support.js b/src/main/webapp/resources/js/base/dataset-support.js index 64fb926..2cc173a 100644 --- a/src/main/webapp/resources/js/base/dataset-support.js +++ b/src/main/webapp/resources/js/base/dataset-support.js @@ -398,7 +398,7 @@ class PagingSupport extends DatasetSupport { this.prefix = conf.ctrl.prefix; this.sizeOffset = conf.sizeOffset || 0; - + this.linkContainer = conf.linkContainer; this.func = conf.func; @@ -416,6 +416,7 @@ class PagingSupport extends DatasetSupport { if (this.linkContainer) { pagination.func = this.func; pagination.added = option.added; + pagination.containers = this.doq.containers; $(this.doq.selector(this.linkContainer)).setPaging(pagination); } } diff --git a/src/main/webapp/resources/js/base/dataset.js b/src/main/webapp/resources/js/base/dataset.js index 0a11e1b..38f92b3 100644 --- a/src/main/webapp/resources/js/base/dataset.js +++ b/src/main/webapp/resources/js/base/dataset.js @@ -1504,6 +1504,10 @@ class DatasetControl { }; } + get doctx() { + return this.doq.containers; + } + prefixed(str) { return (this.prefix || "") + str; }