将新加载的行设置为默认在ag-grid中选择?

时间:2018-07-30 07:01:16

标签: angular typescript ag-grid ag-grid-ng2

当滚动到达表的末尾时,我很懒惰地从服务器上向ag-grid加载数据。使用headercheckbox,我能够选择当前块中的所有行。但是,当我延迟加载下一组数据时,我也默认需要选择它。如何实现?

这是我当前的代码:

ngOnChanges(changes: SimpleChanges) {
    if(changes['assayDataList']){
      this.updateRowData();
      this.rowCountOnRowUpdate = this.rowData.length;
      this.gridOptions.suppressScrollOnNewData = this.rowData.length <= 10 ? false : true;
      if(this.isSelectAll == true){
        this.gridApi.forEachNode(function(rowNode,index){
          //rowNode.setSelected(true);
          this.gridApi.selectNode(rowNode);
        })
      }
    }
  }

  public updateRowData(){
    var self = this;

    if(this.assayTableData == undefined){
      this.assayTableData = this.assayDataList;
    }
    else{
      this.assayTableData = this.assayTableData.concat(this.assayDataList);
    }
    if(this.assayDataList.length<self.gridOptions.cacheBlockSize ||this.assayDataList.length==0 ){
      self.stopApiCalls = true;
    }
    else{
      self.stopApiCalls = false;
    }
    this.rowData = this.assayTableData;

  };

0 个答案:

没有答案