-
-
Notifications
You must be signed in to change notification settings - Fork 381
fix(Table): toggle column not work after resize column width #7726
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,7 +23,7 @@ export async function init(id, invoke, options) { | |||||||||||
|
|
||||||||||||
| export function saveColumnList(tableName, columns) { | ||||||||||||
| const key = `bb-table-column-visiable-${tableName}` | ||||||||||||
| return localStorage.setItem(key, JSON.stringify(columns)); | ||||||||||||
| localStorage.setItem(key, JSON.stringify(columns)); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| export function reloadColumnList(tableName) { | ||||||||||||
|
|
@@ -432,7 +432,7 @@ const setExcelKeyboardListener = table => { | |||||||||||
| } | ||||||||||||
|
|
||||||||||||
| const setFocus = target => { | ||||||||||||
| const handler = setTimeout(function () { | ||||||||||||
| const handler = setTimeout(function() { | ||||||||||||
| clearTimeout(handler); | ||||||||||||
| if (target.focus) { | ||||||||||||
| target.focus(); | ||||||||||||
|
|
@@ -541,9 +541,15 @@ const resetTableWidth = table => { | |||||||||||
| if (group) { | ||||||||||||
| let width = 0; | ||||||||||||
| [...group.children].forEach(col => { | ||||||||||||
| width += parseInt(col.style.width) | ||||||||||||
| let colWidth = parseInt(col.style.width); | ||||||||||||
| if (isNaN(colWidth)) { | ||||||||||||
| colWidth = 100; | ||||||||||||
|
||||||||||||
| colWidth = 100; | |
| const minWidth = table.options && typeof table.options.columnMinWidth === 'number' | |
| ? table.options.columnMinWidth | |
| : 100; | |
| colWidth = minWidth; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,14 +96,14 @@ private static bool GetShownColumns(ITableColumn col, IEnumerable<string>? invis | |
| ret = false; | ||
| } | ||
|
|
||
| // 隐藏列优先 移除隐藏列 | ||
| // 隐藏列存在时隐藏列 | ||
| if (ret && hiddenColumns != null && hiddenColumns.Any(c => c.Equals(columnName, StringComparison.OrdinalIgnoreCase))) | ||
| { | ||
| col.Visible = false; | ||
| } | ||
|
|
||
| // 显示列不存在时 不显示 | ||
|
Comment on lines
-99
to
-105
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Hidden vs shown column precedence appears to have changed and may now contradict the comment Previously, if a column was in both |
||
| if (ret && shownColumns != null && !shownColumns.Any(c => c.Equals(columnName, StringComparison.OrdinalIgnoreCase))) | ||
| // 显示列存在时显示列 | ||
| if (ret && shownColumns != null && shownColumns.Any(c => c.Equals(columnName, StringComparison.OrdinalIgnoreCase))) | ||
| { | ||
| col.Visible = true; | ||
| } | ||
|
Comment on lines
+105
to
109
|
||
|
|
||
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.
issue (bug_risk): saveColumnList no longer returns a value, which may break any code relying on its return
Removing the
returnchanges the function’s signature and can break any callers that usesaveColumnListas an expression (e.g., in a return or condition), even thoughlocalStorage.setItemreturnsundefined. If this change is intentional, either keep thereturnfor backward compatibility or audit/update all call sites to treat this as a side-effect-only function.