Skip to content

Instantly share code, notes, and snippets.

@holyjak
Last active March 24, 2020 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holyjak/314193b66f2207a2349cf3b05ee8f3c3 to your computer and use it in GitHub Desktop.
Save holyjak/314193b66f2207a2349cf3b05ee8f3c3 to your computer and use it in GitHub Desktop.
Fulcro-RAD report needs

I am making a PoC of an app with a number of linked "reports" (mostly master-detail). Some of the features I will need:

  • Ability to sort the tables by one or multiple columns
  • Ability to filter the tables (e.g. "only show people from Norway")
  • Pagination
  • Eventually allow the user to hide some columns (and remember this for the user, e.g. in a cookie / localStorage / server)

As far as I know, fulcro-rad does not support that yet so here are some thoughts about how this could be configured.

;; The following are runtime attributes stored somewhere under the report id in the client state:
;; Sort by first name, then last name, then age (this one oldest first):
::report/sort-attrs [[:person/fname :ascending] [:person/lname :ascending] [:person/age :descending]]
;; Only show people with fname John and lname containing "Sn":
::report/filters {:person/fname "John", :person/lname "Sn"}
;; - the match function for the attribute filters (e.g. `contains` or `starts-with`, ...) would be defined similarly to
;;   e.g. formatting - at the level of the attribute with a possible override on the report (and a default)
;; - the filtering could happen locally and/or on the server (especially important if pagination involved)
;; "Columns" the user has selected to hide:
::report/hide-attrs #{:person/country}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment