Fork me on GitHub
#om
<
2015-07-20
>
a.espolov11:07:18

Can anyone faced similar problem? in the sense of making available the owner in the handler, in this case, the on-click

a.espolov12:07:09

@dnolen: please help me)

dnolen12:07:20

@a.espolov: I don’t have enough information to help you. There’s very little context here.

dnolen12:07:52

Widen the scope of the gist, currently too narrow to understand what the problem might be.

a.espolov12:07:07

In simple terms, om component and html not connected among themselves. From here arises the problem of lack of owner within the scope of the handler, and html

dnolen12:07:30

@a.espolov: yes that cannot possibly work because of Clojure(Script) scoping rules period.

dnolen12:07:11

owner doesn’t exist in the global scope, only your component definition scope where you get it as a parameter.

dnolen12:07:44

@a.espolov: if you’re unclear about scoping rules I strongly recommend getting a grasp of the language fundamentals first before trying to do anything with Om. Using Om is a bit too far in the deep end of the pool wrt. Clojure(Script) language features.

a.espolov12:07:47

I'll try to pass to the function owner, and if it comes to js event, on the move to override its about as

mattly23:07:57

let’s say I had a data structure like {:thing {..} :items [{..} {..} {..}]}, and wanted to render items to a component-list with om/build-all, and I want to pass in :thing. In React/JSX I’d do {items.map(function(item){ return <Item item={item} thing={this.props.thing} /> }).bind(this))}

mattly23:07:06

How would I do this with om?

mattly23:07:43

If i pass in thing to the third argument of build/ build-all under :opts, it doesn’t get observed for changes

mattly23:07:00

should I map over :items and create a new map to pass into build-all ?

nullptr23:07:59

that or just call build with the thing/item it needs, either seems reasonable to me

nullptr23:07:23

(repeatedly, that is)

nullptr23:07:52

`(for [item items] (om/build fn {:thing . :item .} ...

nullptr23:07:20

an additional option would be reference cursors