【问题标题】:Expandable Grid is not aligning with the parent grid可扩展网格未与父网格对齐
【发布时间】:2019-04-29 23:12:17
【问题描述】:

我有一个可扩展网格,其中子网格使用与父网格相同的标题/列。当我展开网格时,子网格未与父网格对齐。

非常感谢任何建议。

【问题讨论】:

    标签: angularjs ui-grid


    【解决方案1】:

    我得到了父网格的每个列宽,因为它已经在页面上呈现。在扩展行的时候,我已经将子网格的列宽分配给了父列的宽度。它成功了。

    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;
                }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多