                      :name [:span "Show: " [:strong "Name"]]}
             {:keys [flat-form]} (om/get-shared owner)
             new-language (:current (om/observe owner (shared/language-cursor)))
+            _ (.log js/console new-language)
             colset! #(put! shared/event-chan
                            {:new-columns
                             (flat-form->sg-columns flat-form

  [data owner]
  "Initializes grid + dataview, and stores them in owner's state."
  (when (seq data)
    (let [{:keys [flat-form]} (om/get-shared owner)
          [grid dataview] (sg-init data flat-form)]
      (om/set-state! owner :grid grid)
      (om/set-state! owner :dataview dataview)
      [grid dataview])))

(def pager-id "pager")

;; FIELDS
(defn get-extra-fields
   "Extra fields that will be displayed on the table."
  [is-filtered-dataview?]
  (let [extra-field  [{:full-name "_rank" :label "#" :name "_rank" :type "integer"}]
        extra-fields (if is-filtered-dataview?
                        extra-field
                      (conj extra-field forms/submission-time-field))] 
        extra-fields))

(defn all-fields [form is-filtered-dataview?]
  "Given a (flat-)form, returns fields for table display.
   Puts extra fields in the beginning, metadata at the end of the table,
   and drops fields that have no data (eg. group/note)."
  ;(.log js/console (apply str extra-fields))
  (->> (concat (get-extra-fields is-filtered-dataview?)
               (forms/non-meta-fields form)
               (forms/meta-fields form :with-submission-details? (not is-filtered-dataview?)))
       (filter forms/has-data?)))

;; SLICKGRID HELPER FUNCTIONS
