角度网格页脚未根据网格调整高度

时间:2014-02-22 12:25:38

标签: ng-grid

我想从ng-grid中删除行时减小高度。我能够删除一行减少网格高度一行。但网格页脚并没有从它的位置移动。

这是我正在使用的代码

- HTML

      <div class="gridStyle" ui-if="InterestInfo.length>0" ng-grid="gridOptions" ng-     style="getTableStyle()"   >

    </div>

- JavaScript的

var varFooterTempate = '<div><button type="button" class="btn btn-xs btn-success"  ng-click="edit(row)"  > ' +
                                   ' <span class="glyphicon glyphicon-plus"></span>' +
                                '</button>'

$scope.getTableStyle = function () {
    var rowHeight = 35;
    var headerHeight = 30;
    var footerHeight = 30;
    return {
        height: ($scope.InterestInfo.length * rowHeight + headerHeight + footerHeight + 5) + "px"
    };
};


    $scope.gridOptions = {
    data: 'InterestInfo',
    headerRowHeight: 30,
    rowHeight: 35,
    footerRowHeight: 30,
    showFooter: true,
    footerTemplate: varFooterTempate,
    columnDefs: [{ field: 'name', displayName: 'Name' },
  { field: 'type', displayName: 'Type' },
  { field: 'number', displayName: 'Number' },
  { field: '', displayName: 'Action', width: 140, sortable: false, cellTemplate: editableInPopup}],
    multiSelect: false

};
$scope.removeRow = function () {


    var index = this.row.rowIndex;
    alert(index);
    $scope.gridOptions.selectItem(index, false);
    $scope.InterestInfo.splice(index, 1);
};

1 个答案:

答案 0 :(得分:3)

我认为该主题的文档目前存在错误。尝试在gridOptions对象中设置 gridFooterHeight 而不是 footerRowHeight