我有一个Expandable网格,其中子网格使用与父网格相同的标题/列。当我扩展网格时,子网格未与父网格对齐。
任何建议都将不胜感激。
答案 0 :(得分:0)
我已经获得了父网格的每列宽度,因为它已经在页面上呈现了。在扩展行时,我为子网格的列宽分配了父列宽。它工作成功。
row.grid.getColumn('column1')。drawnWidth:column1是父网格中列的名称属性。
$scope.gridApi.expandable.on.rowExpandedStateChanged($scope,function(row){
if(row.isExpanded){
row.expandedRowHeight = (row.entity.subGridOptions.data.length * 30);
row.entity.subGridOptions.columnDefs[0].width = row.grid.getColumn('column1').drawnWidth-1;
row.entity.subGridOptions.columnDefs[1].width = row.grid.getColumn('column2').drawnWidth;
row.entity.subGridOptions.columnDefs[2].width = row.grid.getColumn('column3').drawnWidth;
row.entity.subGridOptions.columnDefs[3].width = row.grid.getColumn('column4').drawnWidth;
row.entity.subGridOptions.columnDefs[4].width = row.grid.getColumn('column5').drawnWidth;
row.entity.subGridOptions.columnDefs[5].width = row.grid.getColumn('column6').drawnWidth;
row.entity.subGridOptions.columnDefs[6].width = row.grid.getColumn('column7').drawnWidth;
row.entity.subGridOptions.columnDefs[7].width = row.grid.getColumn('column8').drawnWidth;
row.entity.subGridOptions.columnDefs[8].width = row.grid.getColumn('column9').drawnWidth;
row.entity.subGridOptions.columnDefs[9].width = row.grid.getColumn('column9').drawnWidth;
row.entity.subGridOptions.columnDefs[10].width = row.grid.getColumn('column10').drawnWidth;
row.entity.subGridOptions.columnDefs[11].width = row.grid.getColumn('column11').drawnWidth;
}