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

Fix: Sorting bug fixed when cell values are different types #2164

Open berslen opened 1 week ago

berslen commented 1 week ago

When cell values populated with different types of Objects, code was determining if convertToString by checking the first element in the list. But when there is different type of object for example StrongType it was failing to sort and it was throwing error on String's compareTo methdod.

Example case: image

abineshPalanisamy commented 1 week ago

Hi @berslen ,

We have reviewed the code changes in your pull request. In your pull request, you are checking the type of each cell value. In SfDataGrid, however, the cell values in a column should have a consistent type across the entire column. Therefore, instead of checking each cell individually, we only check the type of the first cell. Checking the type for each cell can cause performance issues, particularly when sorting is performed.

To assist you further with your query, could you please provide more details about your requirements?. Specifically, we would like to understand the reason for checking the cell type of each cell. Any additional information you can provide would be greatly appreciated, as it will help us offer a more precise and effective solution.

Regards, Abinesh P

berslen commented 1 week ago

Hi @berslen ,

We have reviewed the code changes in your pull request. In your pull request, you are checking the type of each cell value. In SfDataGrid, however, the cell values in a column should have a consistent type across the entire column. Therefore, instead of checking each cell individually, we only check the type of the first cell. Checking the type for each cell can cause performance issues, particularly when sorting is performed.

To assist you further with your query, could you please provide more details about your requirements?. Specifically, we would like to understand the reason for checking the cell type of each cell. Any additional information you can provide would be greatly appreciated, as it will help us offer a more precise and effective solution.

Regards, Abinesh P

Table throws exception when all cell values are not same type. In the example screenshot you can see string values and custom cell data model. When sorting comes up to that it can't compare with string because they are different types and custom cell data model is not converted to string. İt's a major issue if you are using strong type as cell's.

SethupathyD commented 3 days ago

Hi @berslen ,

We have checked your query at our end, and we are able to replicate that issue at our end. We have considered this as a bug and logged a bug report regarding this in our feedback portal. We will fix the reported issue and include the changes in our upcoming weekly patch release, which is expected to be rolled out on December 10, 2024. We will let you know once released, and we appreciate your patience until then. You can also track the status of the bug using the feedback link below.

Feedback Link: 63260

Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.

Regards, Sethupathy D.