-
-
Notifications
You must be signed in to change notification settings - Fork 363
fix(Table): update table column order in OnColumnCreating not work #6242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR fixes the table component’s column reordering and width/visibility persistence by threading the updated column list through various lifecycle methods, refactors several reset/reload methods to accept explicit column collections, and converts the ColumnWidth helper from a class to a struct for value semantics. Class diagram for refactored Table column managementclassDiagram
class Table {
+List<ITableColumn> Columns
+void ResetColumnWidth(List<ITableColumn> columns)
+Task ReloadColumnWidthFromBrowserAsync(List<ITableColumn> columns)
+Task ReloadColumnOrdersFromBrowserAsync(List<ITableColumn> columns)
+void InternalResetVisibleColumns(List<ITableColumn> columns, IEnumerable<ColumnVisibleItem>? items = null)
+void ResetVisibleColumns(IEnumerable<ColumnVisibleItem> columns)
}
class ColumnWidth {
+string Name
+int Width
}
Table o-- "*" ITableColumn
Table o-- "*" ColumnVisibleItem
Table o-- "*" ColumnWidth
note for Table "Methods now accept explicit column lists for correct ordering and persistence."
note for ColumnWidth "Now a struct instead of a class."
Class diagram for ColumnWidth struct changeclassDiagram
class ColumnWidth {
+string Name
+int Width
}
note for ColumnWidth "ColumnWidth is now a struct (was a class) for value semantics."
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Thanks for your PR, @yacper. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue in the Table control where changes to a Column’s Order property in the OnColumnCreating callback were not applied. The changes include creating a copy of each column’s initial Order, comparing after the callback, and reordering the Columns collection if any changes are detected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@yacper 感谢提交 PR 看一下 https://www.bilibili.com/video/BV1wBM4zDEnn/?spm_id_from=333.999.0.0 把 CLA 签署一下 |
|
@microsoft-github-policy-service agree |
|
@sourcery-ai review |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6242 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 704 704
Lines 31130 31130
Branches 4402 4402
=========================================
Hits 31130 31130
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @yacper - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/BootstrapBlazor/Components/Table/Table.razor.cs:1177` </location>
<code_context>
}
await ReloadColumnOrdersFromBrowserAsync(cols);
- Columns.Clear();
- Columns.AddRange(cols.OrderFunc());
// 查看是否开启列宽序列化
</code_context>
<issue_to_address>
Columns is cleared and repopulated after InternalResetVisibleColumns, which now takes cols instead of Columns.
If InternalResetVisibleColumns should use the updated columns, move Columns.Clear/AddRange before calling it.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| await ReloadColumnOrdersFromBrowserAsync(cols); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Columns is cleared and repopulated after InternalResetVisibleColumns, which now takes cols instead of Columns.
If InternalResetVisibleColumns should use the updated columns, move Columns.Clear/AddRange before calling it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issues
close #6249
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Bug Fixes:
Summary by Sourcery
Fix table column ordering in the OnColumnCreating callback by deferring the column list update until after ordering is applied, and ensure column widths and visibility resets operate on the updated columns collection.
Bug Fixes:
Enhancements: