 
       constructHeader(element)
 
-
-
       # TODO: better handling of the following if/else stuff
       paginationName = attributes.pagination
 

      tbody = element.find "tbody"
      tr = tbody.find "tr"
      tr.attr("ng-repeat", "item in #{listName} #{filterString} | orderBy:predicate:descending")

      {
        post: ($scope, $element, $attributes) ->

        if $scope.list
          $scope.stub.itemsPerPage * $scope.stub.currentPage - $scope.list.length

      $scope.stub.getFillerArray = () ->
        if $scope.stub.currentPage == $scope.stub.numberOfPages - 1
          itemCountOnLastPage = $scope.list.length % $scope.stub.itemsPerPage
          if itemCountOnLastPage != 0
            fillerLength = $scope.stub.itemsPerPage - itemCountOnLastPage - 1
            x for x in [($scope.list.length)..($scope.list.length + fillerLength)]
          else
            []


      $scope.goToPage = (page) ->
        page = Math.max(0, page)
        page = Math.min($scope.stub.numberOfPages - 1, page)
