You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a list of items that I want to output in a table. Before each item, I want to output the rank of the item:
| 1 | First item |
| 2 | Second item |
To do this I use code along these lines:
(om/build-all display-row rows {:key:id})
Looking at the source-code,
I see that build-all uses map with an index (why not map-indexed?),
but that index (::index) is lost on the way down to my display-row function.
The only way I've managed to get a hold of the index is by the way of the following code:
(aget (aget owner "props") "__om_index")
which seems a bit hackish to me.
Proposed solution:
Add a :index keyword to the opts map for a component which contains the current index if the component is built using build-all
The text was updated successfully, but these errors were encountered:
@slipset seems like you are still the old Om. I recommend you try to do something using build instead of build-all, I believe you can do the same my doing a map yourself, and with your custom map you can send the :index down as you want, like:
Problem statement:
I have a list of items that I want to output in a table. Before each item, I want to output the rank of the item:
To do this I use code along these lines:
Looking at the source-code,
I see that
build-all
usesmap
with an index (why not map-indexed?),but that index (
::index
) is lost on the way down to mydisplay-row
function.The only way I've managed to get a hold of the index is by the way of the following code:
which seems a bit hackish to me.
Proposed solution:
Add a
:index
keyword to theopts
map for a component which contains the current index if the component is built usingbuild-all
The text was updated successfully, but these errors were encountered: