Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ag grid 如何合并Ag网格的单元?_Ag Grid_Ag Grid Ng2 - Fatal编程技术网

Ag grid 如何合并Ag网格的单元?

Ag grid 如何合并Ag网格的单元?,ag-grid,ag-grid-ng2,Ag Grid,Ag Grid Ng2,我使用的是Ag网格,需要将特定单元格合并成一行 我怎样才能做到这一点呢?ag Grid将此称为“列跨越”。在HTML表格的“好时光”中,我们将此称为colspan,而rowspan,用于垂直合并单元格的密切相关操作 无论如何,这里是ag网格参考: 您可以将其添加到特定列的colDef中 cellClass: function(params) { if(params.data.someConditionForCellsToBeMerged) { return params.da

我使用的是Ag网格,需要将特定单元格合并成一行

我怎样才能做到这一点呢?

ag Grid将此称为“列跨越”。在HTML表格的“好时光”中,我们将此称为
colspan
,而
rowspan
,用于垂直合并单元格的密切相关操作

无论如何,这里是ag网格参考:


您可以将其添加到特定列的colDef中

cellClass: function(params) {
    if(params.data.someConditionForCellsToBeMerged) {
      return params.data.someConditionForCellToKeep ? "top-row-span": "bottom-row-span";
    }   
}
然后在css中:

.ag-neo .ag-cell.top-row-span {
  border-bottom: 0px;
}

.ag-neo .ag-cell.bottom-row-span {
  border-top: 0px;
  text-indent: -100em; // you can use this to hide the content of the bottom cell
}

此示例演示如何合并“名字”和“姓氏”字段以形成“姓名”字段


ag网格没有固有的功能。。。但这个gihub问题有一些细节/解决方法:
columnDefs: [
        {
          headerName: 'Name',
          field: 'name',
          filter: true,
          width: 210,
          valueGetter:function(params){
              return params.data.fname+" "+params.data.lname
          }
        },
...
]