【发布时间】:2020-05-07 06:44:12
【问题描述】:
我正在使用具有企业许可证的 angular 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 不存在。你需要加载 具有以下功能的模块: import "@ag-grid-enterprise/column-tool-panel"
【问题讨论】: