I have a SfDataGrid that is a descendant of a Flutter SelectionArea. The datagrid has two columns, both text, a date/time column (e.g., displays values like "2024-12-06 01:02:03 MDT") and a message column (display arbitrary text). There are enough rows in the data grid for it to vertically scroll (e.g., 1000 rows). Each column is rendered as regular Text widgets.
The Flutter selection of text within the SfDataGrid works pretty well.
However, the problem is that if you select text and then the selected text "scrolls off" the visible screen, it loses the selection state and that text is not selected (if you then try to copy text, or if you scroll the previously selected text back into view, it will no longer be selected). When a SfDataGrid is displaying large number of rows and users want to select data within the grid for copying, it's desirable that text selection works in conjunction with scrolling.
Hi KD,
The selection area in the Flutter DataGrid may not work when scrolling through
many rows vertically. This is due to the use of the virtualization concept in
the Flutter DataGrid. You can achieve this with the help of the User Guide
attached below.
UG link : Scrolling
in Flutter DataGrid | DataTable | Syncfusion
Regards,
Sethupathy D.
Hi, thanks for your response. We tried using rowsExtentCache: 1024 (larger than the number of rows in the grid), but this did not change the correctness of the text selection behavior. Any time a row scrolls off the screen the text selection state is messed up. Any ideas?
Hi KD,
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 . We will fix the reported issue and include the
changes in our upcoming weekly patch release, which is expected to be rolled
out on January 07, 2025. We will let you know once released, and we appreciate
your patience until then. You can also track the status of the bug using this
feedback.
Feedback - 64199
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
Hi KD,
We are glad to inform you that the reported problem has been resolved on our end. Therefore, kindly update SfDataGrid to the latest version(28.1.38).
Root cause : When rowsCacheExtent is set, rows are not being reused as expected based on the specified count. However, some rows are still being reused due to an if condition applied to the rowsCacheExtent. We observed that rows are allowed for reuse if their index is less than the item's length. This approach is not appropriate, leading to inconsistent row reuse.
If you have any further queries, please don't hesitate to reach out. We are more than happy to assist you.
Regards,
Abinesh P
Hi Abinesh,
Thank you for the update. I tried upgrading to version 28.1.38 of the package and set rowsCacheExtent to 1000 on the SfDataGrid. However, the behavior appears to be the same where selection state of text in rows that are scrolled off the screen is not preserved. What do you think?
Hi KD,
We have tested the latest version of SfDataGrid (28.1.38) with the latest Flutter SDK. The issue where the selection value would get messed up after selecting a row using the SelectionArea widget and scrolling has been fixed. We have included a video reference showing the behavior before and after the fix, along with the sample used for testing.
Additionally, please note that after selecting a row, if you scroll using the scrollbar, the selection gets cleared. This occurs because the focus of the mouse pointer switches to another widget, which is the default behavior of the SelectionArea widget. To retain the selection, you need to use draggable scrolling instead.
If there are any misunderstandings about your requirements or if your needs differ, please provide specific and detailed information about the expected behavior. Sharing a video reference of the issue, along with the reproduction steps, would be very helpful. Additionally, you can modify the attached sample on your end to reproduce the issue. This additional information will help us address your request comprehensively and provide an appropriate solution.
Regards,
Abinesh P