Skip to content

Commit 5b3856f

Browse files
author
Thinh Nguyen
authored
Merge pull request #17 from mahos/master
make sure scrollIntoView for cell table doesn't throw compile error
2 parents b864a06 + 5553be9 commit 5b3856f

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

map-frontend/frontend-content/src/app/cell-list/cell-list.component.ts

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -281,20 +281,33 @@ export class CellListComponent implements OnInit, OnDestroy, DoCheck {
281281
if (data['points'] && data['points'][0]['customdata']) {
282282
// console.log('data[points][0] is: ', data['points'][0]);
283283
this.clickedUnitId = data['points'][0]['customdata'];
284-
for (const [ind, row] of Object.entries(rows)) {
285-
286-
287-
// console.log('row inner text is - ', row['innerText']);
284+
// for (const [ind, row] of Object.entries(rows)) {
285+
// // console.log('row inner text is - ', row['innerText']);
286+
// if (this.clickedUnitId == row['innerText'].split(' ')[0]) {
287+
// console.log('row1 is: ', row)
288+
// console.log('row unit id is - ', row['innerText'].split(' ')[0]);
289+
// const unitId = row['innerText'].split(' ')[0];
290+
// this.clickedUnitIndex = parseInt(ind, 10);
291+
// row.scrollIntoView({
292+
// behavior: 'smooth',
293+
// block: 'center'
294+
// });
295+
// }
296+
// }
297+
let rowIndex = 0;
298+
for (const row of rows) {
299+
// console.log('inside second loop');
288300
if (this.clickedUnitId == row['innerText'].split(' ')[0]) {
289-
// console.log('row unit id is - ', row['innerText'].split(' ')[0]);
290-
const unitId = row['innerText'].split(' ')[0];
291-
this.clickedUnitIndex = parseInt(ind, 10);
301+
// console.log('row2 is: ', row)
302+
// console.log('row unit2 id is - ', row['innerText'].split(' ')[0]);
303+
this.clickedUnitIndex = rowIndex;
304+
// console.log('index 2 - ', rowIndex);
292305
row.scrollIntoView({
293306
behavior: 'smooth',
294307
block: 'center'
295308
});
296309
}
297-
310+
rowIndex += 1;
298311
}
299312

300313
// rows[this.clickedUnitId].scrollIntoView({

0 commit comments

Comments
 (0)