Fork me on GitHub
#re-frame
<
2015-12-03
>
dfcarpenter17:12:27

Hey everyone, enjoying using reframe so far. I have a quick question about the reframe template. I am trying to make a detail panel accessible from a list view. The list view handler makes an api call which gets all the data I need but I need to find a way to send along a value to the detail panel which is an id for the detail panel to include in it's subscription (subscribe [:flow id]). Not sure how to send along a parameter using the panels setup. Im in the process of creating a new handler that accepts data (as the :set-active-panel does not) Not sure if I am thinking about this correctly or if there is a better way.

mikethompson20:12:10

As I understand it, your view will render an item, and it needs to subscribe to that item. So when we want to render an item, we do this (perhaps in a loop,showing all items): ^{:key item-id}[item-view item-id] And then:

(defn item-view
   [id]
   (let [item   (subscribe [:item id])]
      (fn [render-id]
          (assert (= render-id id))
          [:div   ....use @item in here .....])))

dfcarpenter21:12:16

Thanks, but how do I pass in the initial id to the panel? Im looking at both the routes and view files and wondering how I pass in something to the top level panel which can populate any let variables. I looked at the angular-cat-reframe project and I see that that is setting variables for detail-views through session parameters. I would like to avoid this if possible but im assuming it will require rewriting the panels multimethod and the related handlers

mikethompson23:12:36

The top-level panel would subscribe to the collection of items? Or are you wondering how that collection itself is retrieved from the server?