comparison client/src/components/usermanagement/Usermanagement.vue @ 2503:51dbcbf11c5f critical-bottlenecks

client: addendum for e13daf439068 Of course, as you'd expect, this only solves the problem if you don't care about significant changes in the tables sorting behavior. To point out the difference this commit shows the other way to solve the problem without changing the tables behavior.
author Markus Kottlaender <markus@intevation.de>
date Mon, 04 Mar 2019 16:28:49 +0100
parents e13daf439068
children bb5286acfee2
comparison
equal deleted inserted replaced
2502:e13daf439068 2503:51dbcbf11c5f
169 "currentUser" 169 "currentUser"
170 ]), 170 ]),
171 ...mapState("application", ["showSidebar"]), 171 ...mapState("application", ["showSidebar"]),
172 sortedUsers() { 172 sortedUsers() {
173 const start = (this.currentPage - 1) * this.pageSize; 173 const start = (this.currentPage - 1) * this.pageSize;
174 return this.users.slice(start, start + this.pageSize).sort((a, b) => { 174 return this.users
175 if (a[this.sortColumn].toLowerCase() < b[this.sortColumn].toLowerCase()) 175 .filter(u => u) // to clone the array and leave the original store value intact
176 return this.sortDirection === "ASC" ? -1 : 1; 176 .sort((a, b) => {
177 if (a[this.sortColumn].toLowerCase() > b[this.sortColumn].toLowerCase()) 177 if (
178 return this.sortDirection === "ASC" ? 1 : -1; 178 a[this.sortColumn].toLowerCase() < b[this.sortColumn].toLowerCase()
179 return 0; 179 )
180 }); 180 return this.sortDirection === "ASC" ? -1 : 1;
181 if (
182 a[this.sortColumn].toLowerCase() > b[this.sortColumn].toLowerCase()
183 )
184 return this.sortDirection === "ASC" ? 1 : -1;
185 return 0;
186 })
187 .slice(start, start + this.pageSize);
181 }, 188 },
182 pages() { 189 pages() {
183 return Math.ceil(this.users.length / this.pageSize); 190 return Math.ceil(this.users.length / this.pageSize);
184 }, 191 },
185 tableStyle() { 192 tableStyle() {