gpt4 book ai didi

javascript - 在 Ag-grid 中编辑标题

转载 作者:行者123 更新时间:2023-12-03 01:56:19 25 4
gpt4 key购买 nike

Ag-grid 支持编辑列单元格。如何编辑 ag-grid 中的列标题?

最佳答案

它就在文档本身中。链接:<强>Updating Column Definitions

After the grid has been initialised it may be necessary to update the column definition. It is important to understand that when a column is created it is assigned a copy of the column definition defined in the GridOptions. For this reason it is necessary to obtain the column definition directly from the column.

The following example shows how to update a column header name after the grid has been initialised. As we want to update the header name immediately we explicitly invoke refreshHeader() via the Grid API.

// get a reference to the column
var col = gridOptions.columnApi.getColumn("colId");

// obtain the column definition from the column
var colDef = col.getColDef();

// update the header name
colDef.headerName = "New Header";

// the column is now updated. to reflect the header change, get the grid refresh the header
gridOptions.api.refreshHeader();

关于javascript - 在 Ag-grid 中编辑标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50213489/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com