1

ボタンを含むオーバーレイ コンテナを表示したい。ボタンがクリックされると、イベントが親コンポーネントに伝播される必要があります。私の調査では、私のバージョン(22.1.2)には存在しない「noRowsOverlayComponentParams」を設定するオプションがあることがわかりました。ボタンのクリックイベントも取得できません。

問題を解決する回避策または設定はありますか?

PS: コンポーネントは正しく表示されていますが、クリック イベントを取得できません。

グリッド オプション:

let options: any = {
      defaultColDef: {
        sortable: true,
        filter: true,
        resizable: true
      },
      suppressPaginationPanel: true,
      columnDefs: [...],
      paginationPageSize: 10,
      context: { componentParent: this},
      domLayout: 'normal',
      enableCellTextSelection: true,
      autoSizePadding: 2,
      noRowsOverlayComponent: 'myNoRowsComponent',
      frameworkComponents: {
        myNoRowsComponent: MyNoRowsComponent
      }
    };

MyNoRowsComponent.ts:

import { Component } from '@angular/core';
import { INoRowsOverlayAngularComp } from '@ag-grid-community/angular';
import { INoRowsOverlayParams, IAfterGuiAttachedParams } from '@ag-grid-enterprise/all-modules';

@Component({
  selector: 'app-my-no-rows',
  templateUrl: './my-no-rows.component.html',
  styleUrls: ['./my-no-rows.component.scss']
})
export class MyNoRowsComponent implements INoRowsOverlayAngularComp {

  params: any;

  agInit(params: INoRowsOverlayParams): void {
    this.params = params;

  }

  clickImport() {
    // this.params.context.componentParent.clickButton(); // <-- here I want to emit an event
  }

  afterGuiAttached?(params?: IAfterGuiAttachedParams): void { }

}

MyNoRowsComponent.html:

<button (click)="clickImport()">My Button</Button>
4

2 に答える 2