【问题标题】:Why is the autoHeight property not being recognized?为什么无法识别 autoHeight 属性?
【发布时间】:2018-07-03 14:32:12
【问题描述】:

我正在尝试使用设置为 true 的 autoHeight 属性创建一些列。但是,我不断收到这些警告:

ag-grid: invalid colDef property 'autoHeight' did you mean any of these: suppressAutoSize,headerTooltip,openByDefault,headerComponent,suppressSizeToFit,sort,headerGroupComponent,pivot
<...snip...>
ag-grid: to see all the valid colDef properties please check: https://www.ag-grid.com/javascript-grid-column-properties/

我的列定义如下所示:

const columnDefs = [
  {
    headerName: 'Id',
    field: 'id',
    filter: 'agTextColumnFilter',
    width: 90
  }, {
    headerName: 'Description',
    field: 'sportLeage',
    filter: 'agTextColumnFilter',
    autoHeight: true,
    valueGetter: params =>
      params.context.liveEventsController
        .createDescription(params.data),
    width: 90
  };

autoHeight 明确列为有效的列定义属性。不过,在调试器中,我正在查看 colDefUtil_1.ColDefUtil.ALL_PROPERTIESautoHeight 不是可用属性之一。

我正在使用 ag-grid-enterprise v17.0.0。

我的想法是我的版本已经过时或者文档已经过时了。

【问题讨论】:

    标签: ag-grid


    【解决方案1】:

    检查v17.0.0ColDef here的类型定义代码

    autoHeight 不是ColDef 的属性。

    我目前在v17.1.1 and autoHeight is declared as number

    /** True if this column should stretch rows height to fit contents */
    autoHeight?: number;
    

    PS:cmets 建议它应该是boolean
    现在这让我想起了一句话
    :)

    代码从不说谎,但 cmets 有时会。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-01-12
    • 2018-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-11
    相关资源
    最近更新 更多