Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions eclipse-scout-core/src/table/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5209,8 +5209,10 @@ export class Table extends Widget implements TableModel, Filterable<TableRow> {
createTiles(rows: TableRow[]): Tile[] {
return rows.map(row => {
let tile = this.createTileForRow(row);
this._adaptTile(tile);
tile.rowId = row.id;
if (tile) {
this._adaptTile(tile);
tile.rowId = row.id;
}
return tile;
});
}
Expand Down
7 changes: 5 additions & 2 deletions eclipse-scout-core/src/table/TableTileGridMediator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ export class TableTileGridMediator extends Widget implements TableTileGridMediat
}

setTiles(tiles: ObjectOrChildModel<Tile>[]) {
tiles = arrays.ensure(tiles)
.filter((value, index, array) => value && array.indexOf(value) === index); // remove duplicates
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is O(n^2), using a Set should be faster: [...new Set(tiles)]

this.setProperty('tiles', tiles);
}

Expand Down Expand Up @@ -435,7 +437,7 @@ export class TableTileGridMediator extends Widget implements TableTileGridMediat
this.table.loadingSupport.renderLoading(true);
}

override destroy() {
protected override _destroy() {
// destroy tiles manually since owner is the mediator thus the tileGrid can't destroy them
this.tiles.forEach(tile => tile.destroy());
this.tileAccordion.destroy();
Expand Down Expand Up @@ -528,7 +530,8 @@ export class TableTileGridMediator extends Widget implements TableTileGridMediat
if (!this.table.tileMode || $.isEmptyObject(this.tilesMap)) {
return;
}
this.tiles = this.table.rows.map(row => this.tilesMap[row.id]);
this.tiles = this.table.rows.map(row => this.tilesMap[row.id])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

.filter((value, index, array) => value && array.indexOf(value) === index); // remove duplicates
this.tileAccordion.setTiles(this.tiles);
}

Expand Down