makeHeadersFromRow : manage references cases

pull/848/head
CamilleLegeron 3 months ago
parent 1bcdf0221a
commit 2593b6726d

@ -908,9 +908,16 @@ GridView.prototype.makeHeadersFromRow = async function(selection) {
if (this._getCellContextMenuOptions().disableMakeHeadersFromRow){
return;
}
const record = this.tableModel.tableData.getRecord(selection.rowIds[0]);
const actions = this.viewSection.columns.peek().reduce((acc, col) => {
const colId = col.colId.peek();
let newColLabel = this.tableModel.tableData.getValue(selection.rowIds[0], colId);
let newColLabel = record[colId];
// Manage column that are references
if (col.refTable()) {
const refTableDisplayCol = this.gristDoc.docModel.columns.getRowModel(col.displayCol());
newColLabel = record[refTableDisplayCol.colId()];
}
// Manage column that are lists
if (Array.isArray(newColLabel) && newColLabel[0] === GristObjCode.List) {
newColLabel = newColLabel[1];
}

Loading…
Cancel
Save