Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/441.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
Javascript 使用ag网格企业版实现扩展或折叠_Javascript_Ag Grid - Fatal编程技术网

Javascript 使用ag网格企业版实现扩展或折叠

Javascript 使用ag网格企业版实现扩展或折叠,javascript,ag-grid,Javascript,Ag Grid,我正在尝试将网格处的更改为ag网格。我使用的是企业版,数据结构如下: let data=[ { name: "T-001", attribute: "VOL", plantValue: 71, scheduleValue: 71, baselineValue: 71, newBaselineTime: "2020-01-17T08:30:00+08:00", id: "~7d428201009c3318060a0000" }, { name: "T-001", attribute: "A

我正在尝试将网格处的更改为ag网格。我使用的是企业版,数据结构如下:

let data=[
  { name: "T-001", attribute: "VOL", plantValue: 71, scheduleValue: 71, baselineValue: 71, newBaselineTime: "2020-01-17T08:30:00+08:00", id: "~7d428201009c3318060a0000" },
  { name: "T-001", attribute: "Amenam", plantValue: 72, scheduleValue: 71, baselineValue: 71, newBaselineTime: "2020-01-17T08:30:00+08:00", id: "~7d428201009c3318060a0000" },
  { name: "T-001", attribute: "Arab Light", plantValue: 71, scheduleValue: 71, baselineValue: 71, newBaselineTime: "2020-01-17T08:30:00+08:00", id: "~7d428201009c3318060a0000" },
  { name: "T-002", attribute: "VOL", plantValue: 21, scheduleValue: 71, baselineValue: 71, newBaselineTime: "2020-01-17T08:30:00+08:00", id: "~bb4a8201009c3318060d0000" },
  { name: "T-002", attribute: "Amenam", plantValue: 45, scheduleValue: 71, baselineValue: 71, newBaselineTime: "2020-01-17T08:30:00+08:00", id: "~bb4a8201009c3318060d0000" },
  { name: "T-002", attribute: "Arab Light", plantValue: 54, scheduleValue: 71, baselineValue: 71, newBaselineTime: "2020-01-17T08:30:00+08:00", id: "~bb4a8201009c3318060d0000" },
];
可以这样做吗:。 因此,列坦克可以在同一坦克名称下展开或折叠,就像它在栅格
中的一样。 由于坦克的名称相同,我使用了树数据功能,但这不起作用。但是,按列坦克进行分组与网格处的原始不一样。树数据和组都不适合我

let gridOptions= {
  treeData: true, 
  groupDefaultExpanded: -1, 
  getDataPath: function(data) {
    return data.orgHierarchy;
  };
autoGroupColumnDef:{
  headerName: 'Tank',
  tooltipField:"name",
  pinned: true,
  lockPosition: true,
  headerCheckboxSelection: true,
  headerCheckboxSelectionFilteredOnly: true,
  checkboxSelection: true,
  cellRendererParams: {
  suppressCount: true
},

这种类型的分组行为不需要树数据。只需使用ag网格的行分组功能

首先,通过为该列指定
rowGroup:true
,将您的列名标记为要分组的列名

但是,这将创建一个附加的组列,并显示名称列。因此,您必须通过设置
hide:true
来隐藏名称列

最后,您可以自定义组列以具有自定义名称,并将其传递给
gridOptions

autoGroupColumnDef:{
  headerName: 'Tank',
  tooltipField:"name",
  pinned: true,
  lockPosition: true,
  headerCheckboxSelection: true,
  headerCheckboxSelectionFilteredOnly: true,
  checkboxSelection: true,
  cellRendererParams: {
  suppressCount: true
  }
},