Re: Om design query

2015-03-06 Thread Daniel Kersten
You can provide refs to dom calls and use om/get-node to retrieve them: (dom/div #js {:ref "foo"} ...) (om/get-node owner "foo") It is tied to the owner though and I'm not entirely sure what that means for grabbing refs from other components - as far as I'm aware, it will work just fine for chil

Re: Om design query

2015-03-06 Thread Matthew Davidson
Hmmm. You could use core.async, pass down a channel to children, and pass up an event each time the child is mounted. The parent would start a go-loop on initialization, count the children, and run some code when it gets the right number of child-mounting events. You could also use a general eve

Re: Om design query

2015-03-06 Thread Glen Mailer
In ordinary React I think I would keep all of this logic in the parent, and read from the DOM in didUpdate. There's a feature called refs which can be used to grab references to the rendered children to get their DOM nodes. I'm afraid I don't know how to do the equivalent in Om. -- You receive

Re: Om design query

2015-03-06 Thread James Reeves
On 6 March 2015 at 17:48, Matthew Davidson wrote: > Hmmm. You could use core.async, pass down a channel to children, and pass > up an event each time the child is mounted. The parent would start a > go-loop on initialization, count the children, and run some code when it > gets the right number o

Re: Om design query

2015-03-06 Thread James Reeves
On 6 March 2015 at 15:29, Daniel Kersten wrote: > I should have been clearer. I was thinking by using callbacks like Colin > suggests. I've had code that looks like this before: > > (om/build component data {:opts {:cb #(om/set-state! owner %)}} > That's an interesting approach. I hadn't noticed

Re: Om design query

2015-03-06 Thread Daniel Kersten
I should have been clearer. I was thinking by using callbacks like Colin suggests. I've had code that looks like this before: (om/build component data {:opts {:cb #(om/set-state! owner %)}} On Fri, 6 Mar 2015 14:43 James Reeves wrote: > On 6 March 2015 at 09:13, Colin Yates wrote: > >> I know

Re: Om design query

2015-03-06 Thread James Reeves
On 6 March 2015 at 09:13, Colin Yates wrote: > I know this is a different direction than a lot of people but I store > everything in the app-state and so far it has worked well. There are a > hundred reasons why this (storing everything in app-state) is a > terrible idea, but I haven't run into a

Re: Om design query

2015-03-06 Thread James Reeves
On 6 March 2015 at 08:54, Daniel Kersten wrote: > I've successfully used component local state for similar tasks while > working with DimpleJS charts. > How so? I didn't think a parent component could access the local state of its children. - James -- You received this message because you are

Re: Om design query

2015-03-06 Thread James Reeves
On 6 March 2015 at 05:22, Dave Della Costa wrote: > (cc'ing clojurescr...@googlegroups.com) > > Let me make sure I understand what you're asking: you have a parent > enclosing component that has to do calculations to position a set of > child component element, but you can only properly calculate

Re: Om design query

2015-03-06 Thread Colin Yates
I know this is a different direction than a lot of people but I store everything in the app-state and so far it has worked well. There are a hundred reasons why this (storing everything in app-state) is a terrible idea, but I haven't run into any of them. The main driver for this was for bug repor

Re: Om design query

2015-03-06 Thread Daniel Kersten
I've successfully used component local state for similar tasks while working with DimpleJS charts. On Fri, 6 Mar 2015 05:46 Tom Lynch wrote: > One workable possibility: > > * init a core.async channel in the container > * pass the channel from the container into each child component at build > t

Re: Om design query

2015-03-05 Thread Tom Lynch
One workable possibility: * init a core.async channel in the container * pass the channel from the container into each child component at build time using :opts or :state * send the discovered size of each child component, with identifying data, as a channel message during IDidMount I don't fi

Re: Om design query

2015-03-05 Thread Dave Della Costa
(cc'ing clojurescr...@googlegroups.com) Hi James, Let me make sure I understand what you're asking: you have a parent enclosing component that has to do calculations to position a set of child component element, but you can only properly calculate positioning for those child elements (in the pare

Om design query

2015-03-05 Thread James Reeves
I've been writing an application using Om, and I've come across a problem I haven't been able to find a good solution for. I'd be grateful for any ideas people might have on how to proceed. In a nutshell, I have a bunch of elements that need to be arranged according to a specific algorithm. They c