Register RessourceList click event listener in base Class.

This commit is contained in:
Patrick Jentsch 2021-01-13 11:55:58 +01:00
parent 7b9af7ba15
commit 16dc87bc94
7 changed files with 1 additions and 6 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {