我使用了一个自定义的headerComponent在标题单元格中显示一个复选框,作为带有无限滚动行模型的ag-grid中的全选选项。单击复选框后,我需要能够选择/取消选择当前行块中表中的所有行。同样滚动到表的末尾,将进行服务器调用以获取下一组行。默认情况下,还应该选择加载的新数据。
我知道,ag-grid不支持在无限行模型中选择全部的标题选择。我如何以编程方式执行此操作?我也该如何获取所有选定的行。
这是我当前的代码:
标头组件:
import { Component, OnInit,ViewChild, ElementRef } from '@angular/core';
import {IHeaderParams} from "ag-grid/main";
import {IHeaderAngularComp} from "ag-grid-angular";
@Component({
selector: 'app-customheader',
templateUrl: './customheader.component.html',
styleUrls: ['./customheader.component.css']
})
export class CustomheaderComponent implements IHeaderAngularComp{
private params : any;
agInit(params:any): void {
console.log(params);
this.params = params;
}
toggleSelectAll(){
}
constructor() { }
}
Run Code Online (Sandbox Code Playgroud)
标头组件模板:
<div>
<div *ngIf="params.displayName == ''" ><input type="checkbox" class="selectAllCheckBox" (click)="toggleSelectAll()"> </div>
<div>{{params.displayName}}</div>
</div>
Run Code Online (Sandbox Code Playgroud)
表组件:
constructor(public appServices:AppServices) {
this.rowData = this.assayDataList;
this.columnDefs = [
{
//headerCheckboxSelection: true,
//headerCheckboxSelectionFilteredOnly: true,
checkboxSelection: …Run Code Online (Sandbox Code Playgroud)