> On the subject of templates though, why doesn't something as simple as this
> work to track changes to input fields?
>
>
> (defn handle-change [e data edit-key]
> (println "handle-change:" edit-key @data)
> (om/transact! data edit-key (fn [_] (.. e -target -value))))
>
>
>
> (deftemplate form-contact "public/fragments/f1.html"
> [data]
> {[:input#name] (do->
> (set-attr :value (:name data))
> (listen :on-change #(handle-change % data :name)))})
A few things are happening here. First the value is being updated by the
transact! in the app-state. This update triggers a re-render. The re-render
is what is causing the deselect. Its recreating the input field and because
its a new field its not in focus. We need access to IInitState and IDidUpdate
to make sure the focus stays active.
It looks like this is a gap in kioo. I support the react events in listen but
not the om events. I need to create a wrap transform or add the om protocol
events to listen transform. I will try to put something together tonight and
post an example of how to use it.
--
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.