SAP / fundamental-ngx

Fundamental Library for Angular is SAP Design System Angular component library
https://sap.github.io/fundamental-ngx
Apache License 2.0
267 stars 127 forks source link

[Sourcing][Regression] Row Index gets reset in `pageScrolling` #10183

Closed CSENoni closed 1 year ago

CSENoni commented 1 year ago

Is this a bug, enhancement, or feature request?

bug

Briefly describe your proposal.

As requested from https://github.com/SAP/fundamental-ngx/issues/10171, this issue is created for easier track.

I noticed that Row index (last column) get reseted every 50 rows in current version using pageScrolling. If it is a regression, please help us to fix this soon. This can be replicable with or without virtualScroll.

https://fundamental-ngx.netlify.app/#/platform/table/scrolling

https://github.com/SAP/fundamental-ngx/assets/22842279/a260c5df-bf44-482c-aac5-8b42f86acf9a

Version in https://sap.github.io/fundamental-ngx/#/platform/table/scrolling is not reseted:

https://github.com/SAP/fundamental-ngx/assets/22842279/e812d990-72f9-480b-a5b0-f228f1e0ca16

Which versions of Angular and Fundamental Library for Angular are affected? (If this is a feature request, use current version.)

latest

If this is a bug, please provide steps for reproducing it.

Please refer to link:

Please provide relevant source code if applicable.

https://sap.github.io/fundamental-ngx/#/platform/table/scrolling -> not reset after fetching new page https://fundamental-ngx.netlify.app/#/platform/table/scrolling -> reset after fetching new page

Is there anything else we should know?

CSENoni commented 1 year ago

From @fkolar:

Update

Scrolling Issue is valid problem: and this should be the issue.

Once resets the count based on the given index:

<fdp-column name="rowIndex" key="rowIndex" label="Row index">
        <fdp-table-cell *fdpCellDef="let item; let i = rowIndex">
            <span>Row index {{ i }}</span>
        </fdp-table-cell>
    </fdp-column>

and other keep adding row index mirroring the size of the array.

https://fundamental-ngx.netlify.app/#/platform/table/scrolling? https://sap.github.io/fundamental-ngx/#/platform/table/scrolling, it is using the same code, but it is not reseted.

Even I have fix locally created, there are allot of failed table unitests in the main branch. Even without main change. @mikerodonnell89, any idea. do you have failed tests too? nx tests platform-table ?

fkolar commented 1 year ago

The problem is within setTabelRows

this._dataSourceTableRows = rows;
        this._tableRows = [...this._newTableRows, ...this._dataSourceTableRows];
        this.onTableRowsChanged();

We are putting new and existing rows together, but when we convert Application rows to TableRow we set the index to item's index. So its 0 - 50, 0 - 50.

The solution would be to have something like

this._dataSourceTableRows = rows;
        this._tableRows = [...this._newTableRows, ...this._dataSourceTableRows];
        **this._reIndexRows();**

and this would update the index in the main array

CSENoni commented 1 year ago

It is working fine now. Thanks