Skip to content
Snippets Groups Projects
Commit 16dc87bc authored by Patrick Jentsch's avatar Patrick Jentsch
Browse files

Register RessourceList click event listener in base Class.

parent 7b9af7ba
No related branches found
No related tags found
No related merge requests found
...@@ -3,7 +3,6 @@ class CorpusFileList extends RessourceList { ...@@ -3,7 +3,6 @@ class CorpusFileList extends RessourceList {
super(listElement, {...CorpusFileList.options, ...options}); super(listElement, {...CorpusFileList.options, ...options});
this.corpus = undefined; this.corpus = undefined;
this.user.eventListeners.corpus.addEventListener((eventType, payload) => this.eventHandler(eventType, payload), listElement.dataset.corpusId); this.user.eventListeners.corpus.addEventListener((eventType, payload) => this.eventHandler(eventType, payload), listElement.dataset.corpusId);
listElement.addEventListener('click', event => this.onclick(event));
} }
init(corpus) { init(corpus) {
......
...@@ -3,7 +3,6 @@ class CorpusList extends RessourceList { ...@@ -3,7 +3,6 @@ class CorpusList extends RessourceList {
super(listElement, {...CorpusList.options, ...options}); super(listElement, {...CorpusList.options, ...options});
this.corpora = undefined; this.corpora = undefined;
this.user.eventListeners.corpus.addEventListener((eventType, payload) => this.eventHandler(eventType, payload)); this.user.eventListeners.corpus.addEventListener((eventType, payload) => this.eventHandler(eventType, payload));
listElement.addEventListener('click', event => this.onclick(event));
} }
init(corpora) { init(corpora) {
......
...@@ -3,7 +3,6 @@ class JobInputList extends RessourceList { ...@@ -3,7 +3,6 @@ class JobInputList extends RessourceList {
super(listElement, {...JobInputList.options, ...options}); super(listElement, {...JobInputList.options, ...options});
this.job = undefined; this.job = undefined;
this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload), listElement.dataset.jobId); this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload), listElement.dataset.jobId);
listElement.addEventListener('click', event => this.onclick(event));
} }
init(job) { init(job) {
......
...@@ -2,7 +2,6 @@ class JobList extends RessourceList { ...@@ -2,7 +2,6 @@ class JobList extends RessourceList {
constructor(listElement, options = {}) { constructor(listElement, options = {}) {
super(listElement, {...JobList.options, ...options}); super(listElement, {...JobList.options, ...options});
this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload)); this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload));
listElement.addEventListener('click', event => this.onclick(event));
} }
onclick(event) { onclick(event) {
......
...@@ -3,7 +3,6 @@ class JobResultList extends RessourceList { ...@@ -3,7 +3,6 @@ class JobResultList extends RessourceList {
super(listElement, {...JobResultList.options, ...options}); super(listElement, {...JobResultList.options, ...options});
this.job = undefined; this.job = undefined;
this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload), listElement.dataset.jobId); this.user.eventListeners.job.addEventListener((eventType, payload) => this.eventHandler(eventType, payload), listElement.dataset.jobId);
listElement.addEventListener('click', event => this.onclick(event));
} }
init(job) { init(job) {
......
...@@ -2,7 +2,6 @@ class QueryResultList extends RessourceList { ...@@ -2,7 +2,6 @@ class QueryResultList extends RessourceList {
constructor(listElement, options = {}) { constructor(listElement, options = {}) {
super(listElement, {...QueryResultList.options, ...options}); super(listElement, {...QueryResultList.options, ...options});
this.user.eventListeners.queryResult.addEventListener((eventType, payload) => this.eventHandler(eventType, payload)); this.user.eventListeners.queryResult.addEventListener((eventType, payload) => this.eventHandler(eventType, payload));
listElement.addEventListener('click', event => this.onclick(event));
} }
onclick(event) { onclick(event) {
......
...@@ -39,6 +39,7 @@ class RessourceList { ...@@ -39,6 +39,7 @@ class RessourceList {
</div> </div>
</td> </td>
</tr>`; </tr>`;
if (typeof this.onclick === 'function') {this.list.list.addEventListener('click', event => this.onclick(event));}
} }
eventHandler(eventType, payload) { eventHandler(eventType, payload) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment