Ivan Willig <[email protected]> writes:

> Hello,
>
> I am struggling with how to best represent the common UI pattern where
> there is a collection of objects and a single "active/current" object.
> Often there is a form where the user can edit the "active" object.
>
> I find myself saving a reference to the current id and then looking up that
> object from the collection. This seemed to be the direction that David was
> going with in the immutable-stack,
> https://github.com/KitchenTableCoders/immutable-stack/blob/master/contacts/src/cljs/contacts/core.cljs#L24-L27,
> but I wanted to ask if there was an undated version.
>
> Do other people have other solutions?
>
> Thanks
>
> Ivan Willig
>
> -- 
> 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.

The example above seems quite fine - with the addition that om 0.8.0
would allow you to use a reference cursor to observe the active object.
This frees you from passing it down the render-tree explicitly.

Another thing I've done in my project is specifying a :active (or
:selected, etc.) state-key which gets passed from the parent to the
children. This is a more local, less invasive solution and works quite
fine for tightly coupled components; for example a tag-list where you
can select the tags by clicking.

Cheers
Moritz

-- 
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.

Reply via email to