Ag-grid角度复制菜单选项不可用

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

我正在使用带有企业许可证的,角度为8的ag-grid。由于某些原因,默认的“复制”,“带标题复制”上下文菜单项不可用。仅显示“导出”项。其他企业功能运行正常,但我似乎无法弄清楚如何启用“复制”。

我不确定下一步该怎么做,我尝试使用其他导入,禁用功能,...

ag-grid-angular标签:

<ag-grid-angular
      #agGrid
      style="width: 800px; height: 500px;"
      class="ag-theme-balham"
      [columnDefs]="columnDefs"
      [defaultColDef]="defaultColDef"
      rowGroupPanelShow="always"
      [modules]="modules"
      [sideBar]="true"
      rowSelection="multiple"
      enableRangeSelection="true"
      setSuppressClipboardPaste="false"
      [suppressDragLeaveHidesColumns]="true"
      [suppressMakeColumnVisibleAfterUnGroup]="true"
      [rowData]="rowData"
      (gridReady)="onGridReady($event)"

    ></ag-grid-angular>

测试组件文件如下所示:

import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { AllModules , Module} from "@ag-grid-enterprise/all-modules";
import "@ag-grid-enterprise/core";
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent  {

  private gridApi ;
  private gridColumnApi ;

  private columnDefs;
  private defaultColDef;
  private rowData;
  public modules: Module[] = AllModules;
  constructor(private http: HttpClient) {

    this.columnDefs = [
      {
        field: "athlete",
        width: 150,
        filter: "agTextColumnFilter"
      },
      {
        field: "age",
        width: 90
      },
      {
        field: "country",
        width: 120
      },
      {
        field: "year",
        width: 90
      },
      {
        field: "date",
        width: 110
      },
      {
        field: "gold",
        width: 100
      },
      {
        field: "silver",
        width: 100
      },
      {
        field: "bronze",
        width: 100
      },
      {
        field: "total",
        width: 100
      }
    ];
    this.defaultColDef = {
      enableValue: true,
      enableRowGroup: true,
      enablePivot: true,
      sortable: true,
      filter: true,
    };
  }


  onGridReady(params) {
    this.gridApi = params.api;
    this.gridApi.setSuppressClipboardPaste = false;
    this.gridColumnApi = params.columnApi;

    this.http
      .get("https://raw.githubusercontent.com/ag-grid/ag-grid/master/packages/ag-grid-docs/src/olympicWinners.json")
      .subscribe(data => {
        this.rowData = data;
      });
  }

}

我不确定以下内容是否相关,但是我将其添加为额外信息:当我尝试将企业模块“ AllModules”绑定到ag-angular-grid HTML时,某些功能停止工作(例如边栏),然后出现浏览器错误:

ag-Grid:无法将“列工具面板”用作模块@ ag-grid-enterprise / column-tool-panel不存在。您需要加载具有以下模块的模块:导入“ @ ag-grid-enterprise / column-tool-panel”

angular menu copy ag-grid
2个回答
0
投票

是的,显然,我在使用ag-grid-angular组件时使用了错误的包。

在我使用的模块文件中:

从'ag-grid-angular'导入{AgGridModule};

切换到以下程序包使整个过程像黄油一样平稳:

从'@ ag-grid-community / angular'导入{AgGridModule};


0
投票

感谢您的解决方案:)[在这里](https://www.ag-grid.com/javascript-grid-modules/)可以找到新的模块结构以及如何进行迁移。

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