akveo / akveo/ng2-smart-table

Allow providing static row classes

Đang mở
#1,326 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
1.6k
Fork
867
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Currently, the only way to provide a class to rows seems to be via a function:

```
this.settings = {
rowClassFunction: (row) => {console.log('And again', row); return 'address-column-entry'; },
...
```
this was introduced in this PR: https://github.com/akveo/ng2-smart-table/pull/355

The issue with this pattern is that angular re-executes all functions bound to a template ( [see className input here](https://github.com/akveo/ng2-smart-table/blob/master/projects/ng2-smart-table/src/lib/components/tbody/tbody.component.html#L1) ) during change detection. Depending on how many rows the table has, this leads to unnecessary / heavy performance issues, as the classes are recalculated and applied to the DOM continuously. This is explained here very well: https://lukeliutingchun.medium.com/angular-performance-issue-caused-by-function-calls-in-template-a1a930f40464

With my example code, you can see the function being re-executed endlessly in the console.

It would be nice to have a way to statically set classes to rows, thanks !

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.