Is it possible to have dynamic selectors in kioo?
The app i'm writing is a simple form with many input fields, and wanted to
generalise each input component by passing in the tag to match against, e.g.
(defn editable [data owner {:keys [edit-key input-field] :as opts}]
(reify
om/IInitState
(init-state [_]
{:editing false})
om/IRenderState
(render-state [_ {:keys [editing]}]
(let [text (get data edit-key)
minput (keyword (str "input#" (name edit-key)))]
(kioo/component
"public/fragments/f1.html" [input-field]
{[input-field] (do-input-field text edit-key data owner)})))))
;; do-input-field sets the :value attr and various listen handlers on the input
field
(defn form-app [data owner]
(reify
om/IRender
(render [_]
(kioo/component
"public/fragments/f1.html" [:#header]
{[:input#name]
(substitute
(om/build editable data {:opts {:edit-key :name :input-field
:input#name}}))}))))
the app data being:
{:name "initial name" :address "initial address"} etc
and my form is simply:
<header>
<input id="name"/>
<input id="address"/>
... etc
</header
but this doesn't seem to work. Is this possible?
I'm ultimately trying to build the form using the keys from the app-data and
matching them to form inputs directly, even in the form-app function, but
getting just 1 field to work would be a good start.
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.