Fork me on GitHub
#re-frame
<
2020-04-08
>
alexdavis07:04:14

@m_traven Hi, @lucio and I have been working on a native reagent datatable for the last few weeks. It’s still very much a work in progress but I think it’s better than any other options, unless you need something really powerful in which case a react library like ag grid will do anything you could think of. But if you just need a lightweight solution with client side pagination, filtering, searching and sorting then this is probably useful https://github.com/armincerf/reagent-datatable

alexdavis07:04:28

Let me know if you run into any problems with it

m_traven14:04:19

Thanks for the tips! I tried switching over to ag-grid and so far its working pretty well.

harishtella16:04:35

Another option in Handsontable. We use it from reagent/re-frame. And it’s working out well for us.

alexdavis15:04:46

ag grid is great, just make sure you understand the potential costs, it can get expensive depending on your use case

gekkostate16:04:26

Hi all, how would it be possible to have a reg-event-fx which always execute a db operation but only sometimes executes a dispatch? In other words, something like this:

(reg-event-fx
    :some-fx
    {:db ...
     :dispatch (if ..)})
I've tried the above but it fails because I think :dispatch can't accept nil values.

p-himik16:04:41

Use cond->.

👍 4
gekkostate16:04:14

Oh! Great idea, I'll try that as well.

gekkostate16:04:35

I've done the following and it seems to work:

(let [switch    ...
         event-m {:db (assoc db ...)}]
     (if switch
       (assoc event-m :dispatch [...])
       event-m))

alexdavis16:04:02

If you have medley you could use assoc-some , or merge, like

(merge
 {:db ...}
 (when switch 
  {:dispatch ...}))

alexdavis17:04:19

Probably cond-> is better than merge but assoc-some would still be my preference