   (d/set-value! item-name-field "")
   (d/set-value! item-qty-field 1))
 
+(defn fill-item-input [{:keys [row-id]}]
+  (let [item (css/sel (str "#" row-id))]
+    (d/set-value! item-name-field (d/attr item "data-name"))
+    (d/set-value! item-qty-field (d/attr item "data-qty"))))
+
 (defn log-to-console [event o]
   (js/console.log event ": " o))
 


(def item-deleted (pubsub/publishize (fn [row-id] {:row-id row-id}) bus))

(def basket-loaded (pubsub/publishize identity bus))

(defn add-item-to-list [the-list item]

(pubsub/subscribe bus item-deleted remove-item-from-list)
(pubsub/subscribe bus item-deleted mark-basket-unsaved!)

(pubsub/subscribe bus item-edited fill-item-input)
(pubsub/subscribe bus item-edited remove-item-from-list)
(pubsub/subscribe bus item-edited mark-basket-unsaved!)
(pubsub/subscribe bus item-edited focus-item-input)

(pubsub/subscribe bus quantity-changed change-quantity)
(pubsub/subscribe bus quantity-changed mark-basket-unsaved!)

