This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-01-30
Channels
- # announcements (2)
- # avi (12)
- # aws (6)
- # beginners (49)
- # boot (140)
- # cider (2)
- # cljs-dev (5)
- # cljsrn (9)
- # clojure (149)
- # clojure-czech (6)
- # clojure-miami (1)
- # clojure-nl (2)
- # clojure-russia (19)
- # clojure-ukraine (1)
- # clojurescript (34)
- # conf-proposals (36)
- # core-async (2)
- # cursive (11)
- # emacs (2)
- # funcool (23)
- # hoplon (2)
- # incanter (4)
- # jobs (1)
- # ldnclj (19)
- # om (47)
- # onyx (5)
- # proton (12)
- # re-frame (20)
- # ring-swagger (17)
- # testing (1)
(defn- create-list-view-ds
([] (create-list-view-ds (fn[r1 r2] (not= r1 r2))))
([row-compare-fn]
(let[DataSource (-> js/React .-ListView .-DataSource)]
(DataSource. (clj->js {:rowHasChanged row-compare-fn})))
)
)
(defn- convert-to-array [vec]
(let [arr #js[]]
(doseq [x vec] (.push arr x))
arr)
)
(defn create-list-model
([model row-compare-fn]
(.cloneWithRows (create-list-view-ds row-compare-fn) (convert-to-array model)))
([model]
(.cloneWithRows (create-list-view-ds) (convert-to-array model)))
)
(defn render-row [row-data]
(r/as-element [my-row row-data])
)
(defn my-list-view [list]
(let[ds (utils/create-list-model list)]
[list-view {:dataSource ds :renderRow render-row}])
)
Hi there, I just installed re-natal on W7 and when I run: re-natal init ToBuy
I get this message: Leiningen is required (
which is weird as I have leiningen installed (2.5.2) and it is recognized by everything else I use. Do I need a certain path or environment variable set?
@sveri never tested it on windows so might be that something has to be changed to support it. Presense of lein is checked by executing type lein
@drapanjanas: Ah ok, what is type
in that context? I don't have it installed on windows
I think that makes sense as I dont have it installed in "cygwin" but only in windows, whatever the difference might be
@seantempesta: Nice article re: boot from seancorfield : https://seancorfield.github.io/blog/2016/01/29/rebooting-clojure/
@potapenko, thanks! Now I have to find out what exactly is the difference between your code (that apparently works!) and mine.
Spotted it!
Well, the first thing is the data source should be passed to the view as :dataSource
and not as :data-source
. The latter doesn’t work for whatever reason. As a side note, the render row method can both be passed as :render-row
or :renderRow
and it works both ways. Heh.
Secondly, the render-row
function should return a React component and not an array. The latter would be okay if the array was later rendered by reagent, but the listview doesn’t do any kind of post-processing on the data it gets from render-row and merely tries to return that to React, which bails if it’s a plain clojure array.
Thanks a ton!