user3340568
user3340568

Reputation: 31

Angular ng-grid footer is not adjusting the height according to grid

I want to reduce the height when a row is removed from ng-grid. I am able to delete a row reduce the grid height by a row. but grid footer is not moving from its position.

here is the code I am using

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

Upvotes: 3

Views: 1609

Answers (1)

user1353936
user1353936

Reputation: 124

I believe that the documentation is currently wrong on this topic. Try setting gridFooterHeight instead of footerRowHeight in your gridOptions object.

Upvotes: 3

Related Questions