This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-10
Channels
- # announcements (1)
- # babashka (9)
- # beginners (372)
- # calva (3)
- # cider (9)
- # cljsrn (71)
- # clojure (57)
- # clojure-australia (2)
- # clojure-europe (26)
- # clojure-france (11)
- # clojure-nl (11)
- # clojurescript (5)
- # core-typed (1)
- # fulcro (33)
- # meander (3)
- # off-topic (1)
- # pathom (3)
- # re-frame (4)
- # reagent (6)
- # sci (1)
- # shadow-cljs (34)
- # xtdb (14)
I’m building a simple Todo app in Fulcro where I have a report that lists projects. Projects can have many Todos (via a ref attribute). My report’s source-attribute is :projects/all-projects, a global resolver that returns all :project/ids. My report columns are “:project/label” and “:todo/label” (:todo/label is a “to-many” nested connection of :project/id). When I render the report, it displays the :project/label and a vector of id’s in place of the :todo/label. What’s the proper way to have the report render the individual :todo/labels themselves instead of the “idents in a list” that it displays by default? (My apologies if this is not the right channel for this question…)
Hi @U2U78HT5G - the “source-attribute” is the entry point for the query in a Fulcro RAD report. My source-attribute is:
(defattr all-projects :project/all-projects :ref
{ao/target :project/id
ao/pc-output [{:project/all-projects [:project/id]}]
ao/pc-resolve (fn [{:keys [query-params] :as env} _]
#?(:clj
{:project/all-projects (queries/get-all-projects env query-params)}))})
It returns a list of :project/ids. The other resolvers in the system can reach the report columns: :project/label and :project/project-todos.
Here’s a link to the code: https://github.com/aeberts/fulcro-rad-demo/blob/f0dbc0129068db97e28a5bcd88defc3a7bdacf98/src/shared/com/example/ui/project.cljc#L32