MCPcopy Index your code
hub / github.com/plotly/dash / changeColumnHeader

Function changeColumnHeader

components/dash-table/src/dash-table/utils/actions.js:150–186  ·  view source on GitHub ↗
(
    column,
    columns,
    headerRowIndex,
    mergeDuplicateHeaders,
    newColumnName
)

Source from the content-addressed store, hash-verified

148};
149
150export function changeColumnHeader(
151 column,
152 columns,
153 headerRowIndex,
154 mergeDuplicateHeaders,
155 newColumnName
156) {
157 let newColumns = columns;
158 const maxLength = getHeaderRows(newColumns);
159 const columnIndex = newColumns.findIndex(col => col.id === column.id);
160
161 if (typeof column.name === 'string' && maxLength > 1) {
162 const newColumnNames = Array(maxLength).fill(column.name);
163 const cloneColumn = R.mergeRight(column, {name: newColumnNames});
164 newColumns = newColumns.slice(0);
165 newColumns[columnIndex] = cloneColumn;
166 }
167
168 const {groupIndexFirst, groupIndexLast} = getGroupedColumnIndices(
169 column,
170 newColumns,
171 headerRowIndex,
172 mergeDuplicateHeaders,
173 columnIndex,
174 true
175 );
176
177 R.range(groupIndexFirst, groupIndexLast + 1).map(i => {
178 const namePath = [i, 'name'];
179 if (R.type(newColumns[i].name) === 'Array') {
180 namePath.push(headerRowIndex);
181 }
182 newColumns = R.set(R.lensPath(namePath), newColumnName, newColumns);
183 });
184
185 return {columns: newColumns};
186}
187
188export function editColumnName(
189 column,

Callers 2

editColumnNames.tsFile · 0.90
editColumnNameFunction · 0.85

Calls 4

getGroupedColumnIndicesFunction · 0.85
pushMethod · 0.80
fillMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…