From b854a8c68a06a86cd7dad2e50840e5f661dd0bbd Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Wed, 22 Jan 2020 17:39:30 -0400 Subject: [PATCH] fix: Show/hidden optional columns in table. (#256) --- src/components/ADempiere/DataTable/index.vue | 16 +++++----------- .../ADempiere/DataTable/menu/index.vue | 2 +- .../ADempiere/DataTable/menu/mixinMenu.js | 13 +++++++++---- src/store/modules/ADempiere/panel.js | 14 ++++++++++++-- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/components/ADempiere/DataTable/index.vue b/src/components/ADempiere/DataTable/index.vue index 94a9c905..13e34ef4 100644 --- a/src/components/ADempiere/DataTable/index.vue +++ b/src/components/ADempiere/DataTable/index.vue @@ -49,7 +49,7 @@ /> - + {{ $t('components.filterableItems') }} diff --git a/src/components/ADempiere/DataTable/menu/mixinMenu.js b/src/components/ADempiere/DataTable/menu/mixinMenu.js index 897f67ef..7d869de4 100644 --- a/src/components/ADempiere/DataTable/menu/mixinMenu.js +++ b/src/components/ADempiere/DataTable/menu/mixinMenu.js @@ -221,7 +221,10 @@ export const menuTableMixin = { this.showModal(process) }, showTotals() { - this.$store.dispatch('showedTotals', this.containerUuid) + this.$store.dispatch('changePanelAttributesBoolean', { + containerUuid: this.containerUuid, + attributeName: 'isShowedTotals' + }) }, showOnlyMandatoryColumns() { this.$store.dispatch('showOnlyMandatoryColumns', { @@ -261,9 +264,11 @@ export const menuTableMixin = { }) } }, - optionalPanel() { - this.showTableSearch = false - this.isOptional = !this.isOptional + showOptionalColums() { + this.$store.dispatch('changePanelAttributesBoolean', { + containerUuid: this.containerUuid, + attributeName: 'isShowedTableOptionalColumns' + }) }, fixedPanel() { this.showTableSearch = false diff --git a/src/store/modules/ADempiere/panel.js b/src/store/modules/ADempiere/panel.js index 02cdbc9b..cb513205 100644 --- a/src/store/modules/ADempiere/panel.js +++ b/src/store/modules/ADempiere/panel.js @@ -115,6 +115,8 @@ const panel = { }) params.recordUuid = null + // show/hidden optionals columns to table + params.isShowedTableOptionalColumns = false commit('addPanel', params) }, @@ -772,10 +774,18 @@ const panel = { } }) }, - showedTotals({ commit, getters }, containerUuid) { + changePanelAttributesBoolean({ commit, getters }, { + containerUuid, + attributeName, + attributeValue + }) { const panel = getters.getPanel(containerUuid) const newPanel = panel - newPanel.isShowedTotals = !panel.isShowedTotals + if (isEmptyValue(attributeValue)) { + newPanel[attributeName] = !panel[attributeName] + } else { + newPanel[attributeName] = attributeValue + } commit('changePanel', { panel: panel, newPanel: newPanel