GitHub user MSlivone created a discussion: [Feature Request] Table chart: expose "Display column name" in Customize columns for every column, not only time-comparison ones
## Summary **`column_config[<key>].customColumnName` already exists and both table renderers honour it for every column, but the UI lets you set it only on time-comparison columns.** Please expose *Display column name* in *Customize columns* for every column of the Table and AG Grid Table charts. Big Number with Time Comparison already does exactly this for its columns. Superset 6.1.0, same on `master`. ## Why **A dataset's `verbose_name` and saved metric names are shared by every chart, so they have to be generic. A table header is read in one place and often needs to say something else:** - the same metric appears twice in one table, with different filters or time shifts, and needs two distinguishable headers; - a narrow table needs a short header where the dataset name is long, or the unit already sits in the chart title and would repeat in every column; - one dashboard's audience uses a different term, or a different language, than the dataset metadata. We keep the dataset layer in English and customer-facing text in another language, and this is where we hit the limit first. **Today the only way to rename a table header is to give up the saved metric.** The label pencil is disabled on the *Saved* tab, and a label typed on the *Simple* tab is dropped on save because `DndMetricSelect.handleChange` flattens saved metrics back to the bare `metric_name`. Dimensions can be relabelled only on the *Custom SQL* tab. So every table with its own headers ends up made of ad-hoc metrics and ad-hoc columns, which also hits #38339 and #38340. Changing `verbose_name` is no alternative: it renames the column in every other chart. ## Current behaviour - `plugin-chart-table/src/TableChart.tsx` and `plugin-chart-ag-grid-table/src/utils/useColDefs.ts` render `config.customColumnName || originalLabel` for any column; CSV export uses the same label. **A chart imported with the key set works and keeps it on save.** - `ColumnConfigControl.tsx` prepends the *General* tab (`customColumnName`, `displayTypeIcon`, `visible`) only when `col.isTimeComparisonColumn`; otherwise it uses the plugin's `configFormLayout` or the default one, which has no name field. - `BigNumberPeriodOverPeriod/controlPanel.ts` passes a `configFormLayout` with that *General* tab for all its columns. **The two table control panels pass no layout.** ## Proposal **Pass a `configFormLayout` from the Table and AG Grid Table control panels that prepends a *General* tab with `customColumnName` to the default layout of each data type**, the way Big Number with Time Comparison does. `displayTypeIcon` stays time-comparison only; `visible` is optional. Saved metrics keep their `metric_name` in `metrics`, sorting and search keep using the result-set key, and the header comes from `column_config`. It is a per-chart override, like `d3NumberFormat` there already is. The change is confined to two control panels plus tests. **I am willing to open a PR if maintainers agree with the direction.** ## Out of scope The root limitation is wider: **a saved metric cannot carry a per-chart label in any chart type**, so legends, Big Number titles and Pivot Table headers have the same problem without a `column_config` hook. Fixing that means letting `metrics` carry a saved metric together with a label, a form-data change that deserves its own discussion. This request only uses the hook the table charts already have. GitHub link: https://github.com/apache/superset/discussions/44077 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
