Fork me on GitHub

hi guys, I have a simple cell grid (say 100 * 100) using a <table> which I want to change and update say every 50ms. So I trigger an event every 50ms which updates the grid. It seems to me that I can't get this rate of animation. It's slowed down. relevant code:

(ns ant.views
   [re-frame.core :as re-frame]
   [ant.subs :as subs]
   [ :as ev]

(defn main-panel []
  (let [grid (re-frame/subscribe [::subs/grid])]
    (into [:table {:style {:border "1px solid red"}}]
          (for [row @grid]
            (into [:tr]
                  (for [cell row]
                    [:td {:width "5px" :height "5px"
                          :style {:backgroundColor (if (= cell 1) "black" "white")}}]))))))

(defn dispatch-timer-event
  (let [now (js/Date.)]
    (re-frame/dispatch [::ev/timer now])))

(defonce do-timer (js/setInterval dispatch-timer-event 50))
::subs/grid returns a vector of vectors with dimensions 100*100. What can I do to improve performance in such a case? Should I drop re-frame event flow and just manipulate js directly?


Thanks @jahson. Will have a look.


Hello guys, i'm at situation which has multiple dropdown menus which is depending on each other, so based on the option i select on dropdown#1 i load suitable data into dropdown#2, i was able to creating New model from this type of form, but Editing isn't straightforward, what do you guys suggest ?


What do you mean by “editing”?


Edit the dropdown menus with the data


suppose i have 2 dropdown menus and the second dropdown data depend on the first, when i select option from dd#1 i got data loaded into dd#2


now i have both selected data of dd#1 and dd#2


is it straightforward to load these values ad default with data for both dd#1 and dd#2


i always get dd#2 empty


because i need to select any values from dd#1 to get data loaded


i'm not sure if you got what i mean


So your question is ’how to load data to dd#2 by default`?


my code actually do it but there was a simple bug and i have fixed and everything works

👍 8