gpt4 book ai didi

javascript - AgGrid : applyColumnState is not a function

转载 作者:行者123 更新时间:2023-12-03 15:48:03 72 4
gpt4 key购买 nike

我在我的项目中使用 ag-grid,我在应用表状态时遇到问题。这是我来自 onGridReady 的代码片段功能:

 this.gridApi = params.api;
this.gridColumnApi = params.columnApi;

if (!window.colState) {
console.log("no columns state to restore by, you must save state first");
} else {
this.gridColumnApi.applyColumnState({
state: window.colState,
applyOrder: true,
});
console.log("column state restored");
}
它当然取自 ag-grid。
在它下面我有 this.gridColumnApi.getAllColumns()this.gridColumnApi.autoSizeColumns()功能正常。
问题是 this.gridColumnApi.applyColumnState给我这个错误。
TypeError: _this.gridColumnApi.applyColumnState is not a function
我不明白为什么在 this.gridColumnApi 上调用其他函数有效,但 applyColumnState没有。有什么建议么?
@编辑
我什至试过这个:
componentWillUnmount() {
window.colState = this.props.gridColumnApi.getColumnState();
console.log("column state saved");
if (this.props.gridColumnApi.applyColumnState) {
devLog("IT IS HERE");
} else {
devLog("its not");
}
this.gridColumnApi.resetColumnState();
console.log("column state reset");
}
但我得到 applyColumnStateresetColumnState不是函数错误,这里有什么问题?

最佳答案

检查您的 AgGrid 版本。 ColumnApi.applyColumnState()在版本 24.0.0 中添加.

关于javascript - AgGrid : applyColumnState is not a function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63954071/

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