syncfusion / flutter-widgets

Syncfusion Flutter widgets libraries include high quality UI widgets and file-format packages to help you create rich, high-quality applications for iOS, Android, and web from a single code base.
1.6k stars 783 forks source link

If buildRows is filtered/sort than highlighted row messes up #2148

Closed MalikSamiAwan closed 1 month ago

MalikSamiAwan commented 1 month ago

so if we apply sorting to any of columns and than highlight does not reflect rows located in table as in demo you can see i am clicking on row 1 and its highlighting row 5

DataGridRowAdapter( color: currentRowIndex==highlightRowIndex?highlightRowColor:Colors.transparent, )

https://github.com/user-attachments/assets/107ac49b-4e0a-4164-98af-a27d8ee2e77b

abineshPalanisamy commented 1 month ago

Hi @MalikSamiAwan ,

It seems you are trying to add background color to rows based on the tapped row index. When performing sorting or filtering, you can use DataGridSource.effectiveRows to retrieve the row index. This method returns a copy of DataGridSource.rows, which contains the sorted or filtered collection if sorting or filtering is applied in the DataGrid. Use this property to get the corresponding visible row index for customizations such as setting alternate row colors, changing row colors based on the row index, and more. We have included a sample for your reference. Please review it for further details.

Regards, Abinesh P

MalikSamiAwan commented 1 month ago

Thanks it worked