From 28c861c6df6fa745e44e72a5de76788c85437850 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 30 Mar 2020 18:23:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=86=BB=E7=BB=93=E5=88=97?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E6=A0=B7=E5=BC=8F=E6=97=A0=E6=95=88=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../columns/bootstrap-table-fixed-columns.js | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js index f03b06cda..844e14a53 100644 --- a/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js +++ b/ruoyi-admin/src/main/resources/static/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js @@ -243,8 +243,33 @@ $(".left-fixed-table-columns input[name=btSelectAll]").prop('checked', checkAll); $('.fixed-table-body input[name=btSelectItem]').closest('tr').removeClass('selected'); }); + + $("#" + table.options.id).off('click', '.fixed-table-body').on('click', '.th-inner', function (event) { + $.each(that.$fixedHeader.find('th'), function (i, th) { + $(th).find('.sortable').removeClass('desc asc').addClass('both'); + }); + }); - //// events + // events + this.$fixedHeader.off('click', '.th-inner').on('click', '.th-inner', function (event) { + var target = $(this); + var $this = event.type === "keypress" ? $(event.currentTarget) : $(event.currentTarget).parent(), $this_ = that.$header.find('th').eq($this.index()); + + var sortOrder = ""; + if (table.options.sortName === $this.data('field')) { + sortOrder = table.options.sortOrder === 'asc' ? 'desc' : 'asc'; + } else { + sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc'; + } + table.options.sortOrder = sortOrder; + var sortName = $this.data('sortName') ? $this.data('sortName') : $this.data('field'); + if (target.parent().data().sortable) { + $.each(that.$fixedHeader.find('th'), function (i, th) { + $(th).find('.sortable').removeClass('desc asc').addClass(($(th).data('field') === sortName || $(th).data('sortName') === sortName) ? sortOrder : 'both'); + }); + } + }); + this.$tableBody.on('scroll', function () { that.$fixedBody.find('table').css('top', -$(this).scrollTop()); });