         pieChart managementChart, managements, managementsGroup, all
 
         dc.dataCount(".dc-data-count").dimension(xfilter).group(all)
-        $scope.columns = ["ward","region"]
         makeDataTable("#dc-data-table", wards)
 
         dc.renderAll()

          chart.rescale())
        .yAxis().ticks(4)

    makeDataTable = (selector, dim) ->
      cols = $scope.fields.map((x) -> {mData: x, sDefaultContent: ""})

      datatable = $(selector).dataTable
        bPaginate: true,
        pagingType: "full",
        iDisplayLength: 25,
        scrollX: true,
        scrollY: 500,
        scrollCollapse: true,
        bSort: true,
        bDeferRender: true,
        aaData: dim.top(Infinity),
        bDestroy: true,
        aoColumns: cols

      refreshTable = () ->
        dc.events.trigger () ->
          alldata = dim.top(Infinity)
          datatable.fnClearTable()
          datatable.fnAddData(alldata)
          datatable.fnDraw()

      dc.chartRegistry.list().forEach (chart) ->
        chart.on "filtered", refreshTable

    reduceStatus = (group) ->
      res = group.reduce(\

        (() -> count: 0, total: 0))
      res

String.prototype.endsWith = (suffix) ->
  this.indexOf(suffix, this.length - suffix.length) != -1
