农业网格+ Valuegetter +行分组

时间:2018-07-22 16:53:38

标签: ag-grid

ag-grid valuegetter +行分组,在单元格上单击需要获取参数数据。

对于标题和分组行以外的其他单元格,我们将获取参数数据。

ag-grid的列定义如下:

const scopeOutCurrIndex = function (col, rSeg, isPVInColSegment) {
                    return function (params) {
                       return params.data;
    		   }
                };

                const colDefObj: any = {};
                // for E-NG-GRID
                colDefObj['rowGroup'] = true;
                colDefObj['hide'] = true;

                colDefObj.headerName = this.segLabelMap
                    ? this.gridUtilService.getSegmentLabel(rSegments[i], this.segLabelMap)
                    : rSegments[i];
                colDefObj["isRowSegment"] = true;
                colDefObj["headerId"] = rSegments[i];

                //Set width for column
                colDefObj["width"] = this.calColumnWidth(colDefObj.headerName);

                colDefObj["moduleId"] = moduleIds ? moduleIds[0] : moduleIds;
                colDefObj.valueGetter = scopeOutCurrIndex(rSegments[i], rSegments, this.isPVInColSegment);

1 个答案:

答案 0 :(得分:0)

const scopeOutCurrIndex = function (col, rSeg, isPVInColSegment) {
                return function (params) {
                   return params.node.allLeafChildren[0].data;}
            };
  

我们可以从叶子孩子那里获取数据,ag-grid提供了从叶子孩子那里获取数据的灵活性。