om-next

thinhptran 2017-03-30T08:10:41.889554Z

Hi all, I currently using Om.Next to render my Highchart. It works but it looks ugly so I would like to know if anyone has a better way for it.

thinhptran 2017-03-30T08:10:56.892861Z

;;; Highchart (defui MyLocalChart Object (render [this] (dom/div #js {:style {:height "100%" :width "100%" :position "relative"}})) (componentDidMount [this] (let [{:keys [tableconfig]} (om/props this) my-chart-config (utils/gen-chart-config-handson tableconfig)] (swap! mydb/staticstates assoc :localchart (js/Highcharts.Chart. (dom/node this) (clj->js @my-chart-config))))) (componentDidUpdate [this prev-props new-props] (let [{:keys [tableconfig]} (om/props this) my-chart-config (utils/gen-chart-config-handson tableconfig) chart (:localchart @mydb/staticstates)] ;(.log js/console "My local chart componentDidUpdate") (.destroy chart) (swap! mydb/staticstates assoc :localchart (js/Highcharts.Chart. (dom/node this) (clj->js @my-chart-config))))))

thinhptran 2017-03-30T08:11:23.898770Z

I have to store the highchart in an appstate

thinhptran 2017-03-30T10:10:32.579790Z

solved it: ;;; Highchart (defui MyLocalChart Object (render [this] (let [{:keys [tableconfig]} (om/props this) my-chart-config (utils/gen-chart-config-handson tableconfig)] (dom/div #js {:style {:height "100%" :width "100%" :position "relative"} :ref (fn [mydiv] (if (some? mydiv) (js/Highcharts.Chart. mydiv (clj->js @my-chart-config))))}))))

souenzzo 2017-03-30T12:49:18.558376Z

#js {:a {:b :c}} will make a js object where the value of :a is a clojure object(not a js object) Not sure if thats a problem in your case.