                                                             (dom/a #js {:href (get row href)} (get-in row k))
                                                             (get-in row k)))))))))))))))
 
+(defn sensor-table [cursor owner {:keys [histkey path]}]
+  (reify
+    om/IRender
+    (render [_]
+      ;; Select the first row
+      ;;(put! out {:type :row-selected :row (first (om/get-state owner :data))})
+      (let [cols (get-in cursor [:header :cols])
+            table-id (str (name histkey) "-table")]
+        (dom/table #js {:id table-id
+                        :className "table table-bordered hecuba-table "} ;; table-hover table-stripedso,
+                   (dom/thead nil
+                              (dom/tr nil
+                                      (into-array
+                                       (for [[_ {:keys [label]}] cols]
+                                         (dom/th nil label)))))
+                   (dom/tbody nil
+                              (into-array
+                               (for [{:keys [type deviceId] :as row} (-> cursor :data
+                                                                   (cond-> path path))]
+
+                                 (let [id (str type "-" deviceId)]
+                                   ;; TODO clojurefy ids
+                                   (dom/tr #js {:onClick (fn [_ _ ]
+                                                           (om/update! cursor :selected id)
+                                                           (history/update-token-ids! history histkey id))
+                                                :className (when (= id (:selected cursor)) "row-selected")
+                                                ;; TODO use this to scroll the row into view.
+                                                ;; Possible solution here: http://stackoverflow.com/questions/1805808/how-do-i-scroll-a-row-of-a-table-into-view-element-scrollintoview-using-jquery
+                                                :id (str table-id "-selected")
+                                                }
+                                           (into-array
+                                            (for [[k {:keys [href]}] cols]
+                                              (let [k (if (vector? k) k (vector k))]
+                                                (dom/td nil (if href
+                                                              (dom/a #js {:href (get row href)} (get-in row k))
+                                                              (get-in row k))))))))))))))))
+
 (defmulti render-content-directive (fn [itemtype _ _] itemtype))
 
 (defmethod render-content-directive :text

(defn row-for [{:keys [selected data]}]
  (find-first #(= (:id %) selected) data))

(defn uri-for-selection-change 
  "Returns the uri to load because of change of selection. Returns nil
   if no change to selection"
  [selected selection-key template {{ids :ids} :args}]

      (let [cols (get-in cursor [:header :cols])
            table-id (str (name histkey) "-table")]
        (dom/table #js {:id table-id
                        :className "table table-bordered hecuba-table "} ;; table-hover table-stripedso,
                   (dom/thead nil
                              (dom/tr nil
                                      (into-array
