AgGrid - autoGroupColumn 在工具面板侧边栏中不可见

问题描述 投票:0回答:1

使用 autoGroupColumnDef 创建的组列不会出现在工具面板中是否有原因?我的配置好像是对的我正在创建一个简单的侧边栏,它将显示 2 列 - 一列在 columns 常量中定义,一列在 autoGroupColumnDef 中定义。只有第一个出现在工具栏中。 此列不会出现在工具栏中:

const autoGroupColumnDef = useMemo<ColDef>(() => {
    return addCommonStylesToColDefs([
      {
        showRowGroup: true,
        field: "portfolio_name",
        suppressColumnsToolPanel: false,
        headerName: t(""),
        cellStyle: { fontWeight: "bold" },
        cellRendererParams: {
          suppressCount: true,
          innerRenderer: (params: ICellRendererParams): ReactElement | null =>
            TablePortfolioNameCellRenderer({
              data: params.data
            })
        }
      }
    ])[0]
  }, [])

这个出现在工具栏中:

const columns: Array<ColDef> = addCommonStylesToColDefs([
    {
      headerName: t("assetName"),
      field: "asset_name",
      cellRenderer: AgAssetNameCellRenderer,
      cellStyle: { textAlign: "left" }
    },

我的侧边栏:

const sideBar = useMemo<SideBarDef | string | string[] | boolean | null>(() => {
    return {
      toolPanels: [
        {
          id: "columns",
          labelDefault: "Columns",
          labelKey: "columns",
          iconKey: "columns",
          toolPanel: "agColumnsToolPanel",
          toolPanelParams: {
            // suppressRowGroups: true,
            // showRowGroupsSection: true,
            suppressValues: true,
            suppressPivots: true,
            suppressPivotMode: true,
            suppressColumnFilter: true,
            suppressColumnSelectAll: true,
            suppressColumnExpandAll: true
          }
        }
      ],
      defaultToolPanel: "columns"
    }
  }, [])

agGrid 组件:

 <AgGrid
          ref={gridRef}
          autoResizeColumns={false}
          columnDefs={columns}
          defaultColDef={defaultColDef}
          pagination
          paginationPageSize={PaginationPageSize}
          domLayout="autoHeight"
          rowModelType="serverSide"
          onGridReady={onGridReady}
          treeData
          autoGroupColumnDef={autoGroupColumnDef}
          getRowId={(params): string => params.data.id}
          cacheBlockSize={CacheBlockSize}
          isServerSideGroup={(data): boolean => data.entries && data.entries.length > 0}
          getServerSideGroupKey={(dataItem): string => dataItem.id}
          onStoreRefreshed={onStoreRefreshed}
          onRowGroupOpened={({ node, expanded }): void => handleRowExpand(node, expanded)}
          sideBar={sideBar}
        />
ag-grid toolbar sidebar ag-grid-react
1个回答
-1
投票

您找到解决方案了吗?

© www.soinside.com 2019 - 2024. All rights reserved.