From ad3ea92fec3d1c36fa6a6e2ae59af404d6397d0d Mon Sep 17 00:00:00 2001 From: Jean-Marie Simonet Date: Sun, 12 Aug 2018 06:42:57 +0200 Subject: [PATCH] [4.0] FIX searchtools --- build/media_src/system/js/searchtools.es6.js | 28 +++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/build/media_src/system/js/searchtools.es6.js b/build/media_src/system/js/searchtools.es6.js index 2e1775cecae20..380be99d756b4 100644 --- a/build/media_src/system/js/searchtools.es6.js +++ b/build/media_src/system/js/searchtools.es6.js @@ -86,6 +86,28 @@ // Get values this.searchString = this.searchField.value; + // Do some binding + this.showFilters = this.showFilters.bind(this); + this.hideFilters = this.hideFilters.bind(this); + this.showList = this.showList.bind(this); + this.hideList = this.hideList.bind(this); + this.toggleFilters = this.toggleFilters.bind(this); + this.toggleList = this.toggleList.bind(this); + this.checkFilter = this.checkFilter.bind(this); + this.clear = this.clear.bind(this); + this.createOrderField = this.createOrderField.bind(this); + this.checkActiveStatus = this.checkActiveStatus.bind(this); + this.activeFilter = this.activeFilter.bind(this); + this.deactiveFilter = this.deactiveFilter.bind(this); + this.getFilterFields = this.getFilterFields.bind(this); + this.getListFields = this.getListFields.bind(this); + this.hideContainer = this.hideContainer.bind(this); + this.showContainer = this.showContainer.bind(this); + this.toggleContainer = this.toggleContainer.bind(this); + this.toggleDirection = this.toggleDirection.bind(this); + this.updateFieldValue = this.updateFieldValue.bind(this); + this.findOption = this.findOption.bind(this); + if (this.filterContainer && this.filterContainer.classList.contains('js-stools-container-filters-visible')) { this.showFilters(); this.showList(); @@ -128,10 +150,10 @@ this.createOrderField(); this.orderCols.forEach((item) => { - item.addEventListener('click', () => { + item.addEventListener('click', (event) => { // Order to set - const newOrderCol = self.getAttribute('data-order'); - const newDirection = self.getAttribute('data-direction'); + const newOrderCol = event.target.getAttribute('data-order'); + const newDirection = event.target.getAttribute('data-direction'); const newOrdering = `${newOrderCol} ${newDirection}`; // The data-order attribute is required