Changes for page CLB Search Component
Last modified by bougault on 2023/01/17 11:42
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -43,19 +43,22 @@ 43 43 } 44 44 45 45 connectedCallback() { 46 + // this.attachShadow({ mode: 'open' }); 46 46 super.connectedCallback(); 47 47 this.render(); 48 - this.$('#search').addEventListener('click', this.handleSearch); 49 - this.$('#prev').addEventListener('click', this.handlePrevPage); 50 - this.$('#next').addEventListener('click', this.handleNextPage); 49 + this.$('#search').addEventListener('click', () => this.handleSearch()); 50 + this.$('#prev').addEventListener('click', () => { 51 + if(this.offset > 0) { 52 + this.offset--; 53 + this.handleSearch(); 54 + } 55 + }); 56 + this.$('#next').addEventListener('click', () => { 57 + this.offset++; 58 + this.handleSearch(); 59 + }); 51 51 } 52 52 53 - disconnectedCallback() { 54 - this.$('#search').removeEventListener('click', this.handleSearch); 55 - this.$('#prev').removeEventListener('click', this.handlePrevPage); 56 - this.$('#next').removeEventListener('click', this.handleNextPage); 57 - } 58 - 59 59 get styles() { 60 60 return ` 61 61 input[type="text"] { ... ... @@ -63,16 +63,6 @@ 63 63 } 64 64 ` 65 65 } 66 - handlePrevPage = () => { 67 - if(this.offset > 0) { 68 - this.offset--; 69 - this.handleSearch(); 70 - } 71 - } 72 - handleNextPage = () => { 73 - this.offset++; 74 - this.handleSearch(); 75 - } 76 76 77 77 handleSearch = () => { 78 78 const value = this.$('input[type="text"]').value;