Fork me on GitHub
#re-frame
<
2020-03-24
>
Ramon Rios16:03:17

Does anyone tried to create editable cells in re-frame datatable??

p-himik17:03:59

What do you mean by editable cells?

p-himik17:03:15

Or by "re-frame datatable", for that matter.

Ramon Rios17:03:13

It does not support natively for i got a cell and edit their value

p-himik17:03:35

What if you use a custom cell renderer? Would that work?

Ramon Rios17:03:07

That's what i'm trying to do right now

Ramon Rios11:03:15

I create one. Now i'm trying to put my logic on it

Ramon Rios11:03:03

I was able to create a text-field inside a cell, but i'm trying to make it more dynamic for noe

Travis Smith23:03:58

If anyone has familiarity with todomvp, I could use some help. I'm trying to create a new event based on :add-todo such that I could add multiple entries at once. This is because I would like to load the checklist with items when a user presses a button. I'm new to Clojure/CLJS, so progress is slow. Here is the function in question: ;; usage: (dispatch [:add-todo "a description string"]) (reg-event-db :add-todo todo-interceptors (fn [todos [_ text]] (let [id (allocate-next-id todos)] (assoc todos id {:id id :title text :done false}))))

phronmophobic23:03:14

you’ll probably want to rename the event. an event :add-todos might look like:

;; usage (dispatch [:add-todos ["first" "second" third"]])
(reg-event-db
  :add-todos
  todo-interceptors
  (fn [todos [_ items]]
    (reduce (fn [todos text]
              (let [id (allocate-next-id todos)]
                (assoc todos id {:id id :title text :done false})))
            todos
            items)))
I haven’t tested it, but hopefully it’s close

Travis Smith20:03:17

Thanks very much. I'm going to try this out today.

phronmophobic23:03:57

alternatively, you could have your button dispatch multiple :add-todo events

(doseq [text ["first" "second" "third"]]
  (dispatch [:add-todo text]))
not sure which is preferable

🙂 4