Fork me on GitHub

thanks @tony.kay that was too easy 🙂 I usually do pass symbol, but some times I want to just say .. just use the class for the current form.

Björn Ebbinghaus14:05:41

Hey, I am trying to use dr/current-route for rendering. My component has the following query, but it still won’t rerender when the route of ContentRouter changes.

{:query [[:com.fulcrologic.fulcro.ui-state-machines/asm-id :todoish.ui.todo-app/ContentRouter]]}
Any tips what I am doing wrong?


just in case, your router query (the one which queries for the router itself, not for ASM) should be the first in the :query list, otherwise there can be rendering issues with dr/current-route


this is not true


My only tip is that the current route is data in db just like everything else so you can add debugging print statements or whatever you use for debugging to track the value over time - that way you can determine if the issue is the actual data not being updated at the time you want it to - or if it's a rendering issue

Björn Ebbinghaus22:05:37

Thanks. The issue resolved itself… Somehow it started to behave like expected.


@tony.kay given a defsc-form, is it possible to add custom behaviour to its action-buttons, or modify the state machine associated with the form.


you can completely override the state machine using ::form/machine (I think that is the option name).


don’t remember how much I made for customizing control buttons in generated UI…but there are all sorts of angles you can expand


you could: 1. Create a custom UI style for your form, and define a new control renderer that accepts whatever optiosn you want 2. Add a body to your form and render the fields and controls yourself, or partially use plugin UI to render parts, and control others


3. override the state machine def, and customize what it does


@tony.kay that means I can specify keys from the ::form (::form/machine) ns also in a defsc-form? I was currently considering keys only in the ::forms-options ns. Also will the ::form-options ns keys work for the reports also ? I wanted to specify a derived field (`fo/triggers`) and then the layout (`fo/layout`) to place that derived field, can I do that in a report using form-options keys ?


so, the form-options ns are the officially supported options that I’ve documented. Don’t see myself changing the machine one, but it isn’t documented yet. no, you cannot use form options on reports.


cool thanks that gives me lot of flexibility, if I can use the ::form/machine with defsc-forms.


@tony.kay I would like to add a total of one of the columns, the end of the table that the rad report is displaying, is there a way to do that ?


At present, there is not an interface to header/footer kinds of things. You can take control of the rendering, and use things from the plugin to render the parts, or you could just do something like this for the body of the report:

  (report/render-layout this)
  (div "Total: " ...use props to figure out total...))


that won't make it part of the table itself, but it'll get the info on screen.


Summary rows should be something supported...but I don't need them yet, and am busy


Also remember that RAD isn't meant to do everything. It has escape hatches everywhere. It is intended to get something stood up quickly, not be a complete "kitchen sink".


I would like to contribute, could you point me to sections where I can look for making the change ///


So, there isn't a ton of code to it. The main report.cljc ns has most of the logic, except where the concern is primarily a UI bit of logic (very little of that). The semantic-ui plugin is where rendering is. The default style is you look in semantic_ui_controls.cljc, and find the UI thing of interest and follow it. The pluggable stuff makes it a little hard to trace. Best to understand the data model of the report UISM and generated component (i.e. the query).


Summary rows need a little do they interact with pagination? etc.


can there be more than one? Do you supply one for each column? Is it a summary sub-table with multiple rows?


The main trouble is probably just pagination...supporting a simply summary row isn't that hard. I imagine you'd just supply a function that has to return a "row" map with the same keys as what you have for columns, and just render that as a tfoot


perhaps an option for "on each page" or "in total"...that will (might?) affect that function's signature


::report/footer (fn [rpt] {:sales/amount (reduce + ...)})


where rpt is the instance, where you can get the props and look at everything from that paginate flag to the currently visible rows


I guess you could easily make that return a map or vector...if a vector, then it renders more than one summary row? Not sure about labels, though


I guess there could be a ::report/footer-headings or something that could supply strings for each column, and the rendering plugin could figure out something to do with them??? No great ideas there at the moment.


thanks let me dig into the above and then will get back if I am stuck somewhere

eccentric J22:05:06

Would it be an uphill battle to use with fulcro? It has om bindings so would it just work?

eccentric J23:05:20

Ah yes, I saw that! But I also noticed it was separated out for Fulcro 3 so you could use other tools if you preferred. Are there any major advantages to fulcro-garden-css I'm missing?