syncfusion / flutter-examples

This repository contains the Syncfusion Flutter UI widgets examples and the guide to use them.
Other
1.94k stars 772 forks source link

[SfDataGrid] [BugFix] When only one row, ColumWidth fitByValue failed #860

Closed YancyHsu closed 5 days ago

YancyHsu commented 2 months ago

two or more it works well, so maybe somewhere rowindex start from 1? i cant find it in the source code

YancyHsu commented 2 months ago

https://github.com/syncfusion/flutter-widgets/blob/ee87b7b6a735a9a303d7e7973fa4540d0337b64e/packages/syncfusion_flutter_datagrid/lib/src/datagrid_widget/runtime/column.dart#L656

if (startRowIndex <= 0 && endRowIndex <= 0) {
      return column._actualWidth;
    }

just annotation it, or revise to:

if (startRowIndex < 0 && endRowIndex < 0) {
      return column._actualWidth;
    }

then it is ok to run only one row datasource

abineshPalanisamy commented 1 month ago

Hi @YancyHsu ,

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 August 20, 2024. We will let you know once released, and we appreciate your patience until then.

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, Abinesh P

abineshPalanisamy commented 2 weeks ago

Hi @YancyHsu ,

We are glad to inform you that the reported problem has been resolved on our end. Therefore, kindly update SfDataGrid to the latest version(26.2.10).

Root cause : We previously implemented a condition to calculate the cell width when the effective rows are empty. This condition is the root cause of the bug. The issue occurs because the condition checks if endIndex <= 0. However, the endIndex is 0 whether the effective rows are empty or contain a single row.

If you have any further queries, please don't hesitate to reach out. We are more than happy to assist you.

Regards, Abinesh P

ashok-kuvaraja commented 5 days ago

Hi @YancyHsu,

We believe that the reported issue has been resolved in the latest DataGrid version. Hence, we are closing this issue. If you need any further assistance, please reopen this ticket. We are always happy to help you.

Regards, Ashok K