-
-
Notifications
You must be signed in to change notification settings - Fork 457
allow re-ordering columns within table widget #4985
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
base: develop
Are you sure you want to change the base?
allow re-ordering columns within table widget #4985
Conversation
|
@seancolsen I have tried a different approach which ensures component encapsulation. |
|
Hey @seancolsen, just checking in — are my changes okay, or should I make any additional updates? |
|
Sorry, but I'm having trouble deciding how to proceed here. This does seem to work. But the code has some strange patterns that I'm hesitant to merge. I'd rather not take the time to explain why right now. I did some work myself towards implementing this fix "the right way", but I ran into a bug in a different part of the codebase that is proving tricky to track down. Overall, I need to make sure I don't spend too much time on this since it's not a high priority for maintainers right now. I'd like to keep the open and potentially come back to it later. For what it's worth, the direction I wanted to head was to use this code in function buildWidgetInput(
joinableTable: JoinableTable,
tablesData: TablesData,
) {
const table = tablesData.tablesMap.get(joinableTable.target);
if (!table) return undefined;
const fkColumnId = joinableTable.join_path[0].slice(-1)[0][1];
const { name } =
joinableTablesResult.target_table_info[table.oid].columns[fkColumnId];
return { table, fkColumn: { id: fkColumnId, name, metadata: null } };
}
$: tableWidgetInputs = joinableTablesResult.joinable_tables
.filter((joinableTable) => joinableTable.multiple_results)
.map((joinableTable) => buildWidgetInput(joinableTable, $currentTablesData))
.filter(isDefinedNonNullable)
.sort((a, b) => a.table.name.localeCompare(b.table.name));Along with sorting out the import for |
Fixes #4753
Technical details
Based on previous closed PR #4980
Previously, when columns were reordered in the main table view, the
table widget on the record page would not reflect the new column order.
This fix adds explicit reactivity tracking for table.metadata.column_order
within the TableWidget component. When the column order changes, the
TabularData instance is recreated with the updated table metadata,
ensuring the widget displays columns in the correct order.
The solution maintains component encapsulation by handling all reactivity
logic internally within TableWidget, without requiring changes to the
parent Widgets component.
Checklist
Update index.md).developbranch of the repositoryvisible errors.
Developer Certificate of Origin
Developer Certificate of Origin