带打字稿和角度的ag-grid-使用类型定义

时间:2018-10-28 13:33:09

标签: ag-grid

我很好奇如何以打字的方式使用农业网格,角度和打字稿。

在示例中,我看不到任何类型定义的用法,例如在使用columnDefs,回调(gridReady,firstDataRendered)或valueGetter函数等时……

1 个答案:

答案 0 :(得分:1)

您看过documentationrepo吗?

  

columnDefs ColDef

它太大而无法复制,只需检查ColDef内的ag-grid/packages/ag-grid-community/dist/lib/entities/colDef.d.ts界面

  

gridReady AgGridEvent

export interface AgEvent {
    type: string;
}
export interface AgGridEvent extends AgEvent {
    api: GridApi;
    columnApi: ColumnApi;
}
  

firstDataRendered FirstDataRenderedEvent

export interface FirstDataRenderedEvent extends AgGridEvent {
    firstRow: number;
    lastRow: number;
}
  

valueGetter ValueGetterParams

export interface BaseColDefParams {
    node: RowNode;
    data: any;
    colDef: ColDef;
    column: Column;
    api: GridApi;
    columnApi: ColumnApi;
    context: any;
}
export interface ValueGetterParams extends BaseColDefParams {
    getValue: (field: string) => any;
}