               @elementsToShow.push task
         else
           @elementsToShow = @allElements
-       
+
         @updatePageCount()
         @displayJSON(@getElementsForPage(0))
       )
-      
+
 
   displayJSON : (jsonArray) ->
-    
+
     htmlArray = []
-    
+
     for element in jsonArray
       htmlArray.push(@generateHTML(element))
 



  getElementsForPage : (index) ->
    
    start = @rowsPerPage * index
    return @elementsToShow.slice(start, start + @rowsPerPage)


  updatePageCount : ->
    
    @pageSelectionDiv.bootpag(
      total: Math.ceil(@elementsToShow.length / @rowsPerPage)
      page:  1



  extractTemplate : ->

    templateSource = _.unescape(@tbody.html())
    # compile
    @template = _.template(templateSource)
