 #   * You should attempt to narrow your selection as much as possbile to improve performance
 #   * The default query is `{}`
 
+# ##### setQuery()
 Template.dataTable.setQuery = ( query ) ->
   Match.test query, Object
   @setData 'query', query
   @log 'query:set', query
 
+# ##### prepareQuery()
 Template.dataTable.prepareQuery = ->
   unless @getQuery()
     @setQuery {}
 
+# ##### getQuery()
 Template.dataTable.getQuery = ->
   return @getData().query or false
 

# ##### setSubscriptionAutorun()
#   * creates a reactive computation that runs when the subscription is `ready()`
#   * sets up local cursor ( identical to server except no skip )
#   * fetches data from collection and passes it to datatables
#     * does this by calling the `fnCallback()` passed to `fnServerData()`
#     * sends an unaltered copy of `sEcho` ( draw count ) to datatables
#     * gets total docs, before filtering i.e. the total number of records in the database
#     * gets total records, after filtering i.e. the total number of records after filtering has been applied
#       * both of these counts come from the `DataTableSubscriptionCount` collection on the client
#       * `DataTableSubscriptionCount` is populated reactively by the DataTables publication for this table
#       * The selector used to retrieve the counts is the subscription name and + '_filtered'

Template.dataTable.setSubscriptionAutorun = ( fnCallback ) ->
  Match.test fnCallback, Object
  if @getSubscriptionAutorun()

    column.mRender = ( dataSource, call, rawData ) ->
      rawData[ column.mData ] ?= ""

# ##### getColumns()
Template.dataTable.getColumns = ->
  return @getData().columns or false

