J4 Issue
avatar infograf768
infograf768
10 Aug 2018

As title says

Js error

TypeError: self.getAttribute is not a function in searchtools.js 145:29

@dgrammatiko

avatar infograf768 infograf768 - open - 10 Aug 2018
avatar joomla-cms-bot joomla-cms-bot - change - 10 Aug 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 10 Aug 2018
avatar infograf768 infograf768 - change - 10 Aug 2018
Labels Added: J4 Issue
Removed: ?
avatar infograf768 infograf768 - labeled - 10 Aug 2018
avatar infograf768 infograf768 - unlabeled - 10 Aug 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 10 Aug 2018
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 10 Aug 2018
Category JavaScript
avatar infograf768
infograf768 - comment - 10 Aug 2018

Ok, found the culprit
code should be

          var newOrderCol = this.getAttribute('data-order');
          var newDirection = this.getAttribute('data-direction');

will make patch

avatar infograf768
infograf768 - comment - 10 Aug 2018

hmm
using npm install with a modified searchtools.es6.js where I have
const newOrderCol = this.getAttribute('data-order');
const newDirection = this.getAttribute('data-direction');

creates a searchtools.js with
var newOrderCol = _this.getAttribute('data-order');
var newDirection = _this.getAttribute('data-direction');

I.e. an underscore is added...

although we have in the es6 file
const self = this;
self does not work either.

@dgrammatiko
I am lost

avatar dgrammatiko
dgrammatiko - comment - 10 Aug 2018

This should work:

item.addEventListener('click', (event) => {
  // Order to set
  const newOrderCol = event.target.getAttribute('data-order');
  const newDirection = event.target.getAttribute('data-direction');
  const newOrdering = `${newOrderCol} ${newDirection}`;

Obviously this is the class so it won't work on this case as we want to fetch the attributes of the element clicked. And obviously you have to blame me for this ?

avatar infograf768
infograf768 - comment - 10 Aug 2018

That's it. making patch now.

avatar infograf768
infograf768 - comment - 10 Aug 2018

See #21539

avatar infograf768 infograf768 - change - 10 Aug 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-08-10 13:43:58
Closed_By infograf768
avatar infograf768 infograf768 - close - 10 Aug 2018
avatar ReLater
ReLater - comment - 10 Aug 2018

Could you reopen here pls. because the pr is closed without merging?

avatar brianteeman brianteeman - change - 10 Aug 2018
Status Closed New
Closed_Date 2018-08-10 13:43:58
Closed_By infograf768
avatar brianteeman brianteeman - reopen - 10 Aug 2018
avatar brianteeman
brianteeman - comment - 10 Aug 2018

Reopened as requested

avatar franz-wohlkoenig franz-wohlkoenig - change - 11 Aug 2018
Status New Discussion
avatar infograf768
infograf768 - comment - 12 Aug 2018

Closed as we have patch
#21562

avatar infograf768 infograf768 - change - 12 Aug 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-08-12 04:48:33
Closed_By infograf768
avatar infograf768 infograf768 - close - 12 Aug 2018

Add a Comment

Login with GitHub to post a comment