This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-04
Channels
- # announcements (10)
- # babashka (16)
- # beginners (3)
- # calva (14)
- # clj-kondo (119)
- # clojure (15)
- # clojure-nl (2)
- # clojure-uk (2)
- # clojurescript (15)
- # conjure (1)
- # datascript (1)
- # duct (1)
- # fulcro (2)
- # lsp (6)
- # malli (1)
- # off-topic (9)
- # polylith (3)
- # re-frame (9)
- # reagent (12)
- # reitit (6)
- # shadow-cljs (27)
- # sql (14)
- # vim (5)
Hi, iām working with reagent & antd table(http://ant.design/components/table/#components-table-demo-head), the UI works fine but how to define the javascript function for sorter prop in reagent: (a, b) => a.age -b.age ?
Any ClojureScript function is a JavaScript function. Just use JS interop so e.g. a.age
becomes (.-age a)
. Also make sure to add ^js
in front of such symbols' definitions to prevent them from being mangled by GCC during advanced optimizations.
(Unless you need them to be mangled - depends on your code and on how the table works, I suppose.)
Has anyone used react-virtualized with reagent? I'm trying to follow this (https://github.com/bvaughn/react-virtualized/blob/master/docs/Table.md) example with the following code
(defn materialized-table
[]
[:> Table {:width 300
:height 300
:headerHeight 20
:rowHeight 30
:rowCount (count movies)
:rowGetter (fn [index] (let [movie (get movies (aget index "index"))]
(println movie)
movie))}
[:> Column {:label "Nome" :dataKey :name_pt :width 500}]]
)
And I can see that the items are in the DOM, but no text is rendered on the screen. If I open the console and scroll I can see the rowGetter function being called and the data is fine, but nothing shows up on the screen.
I think it might be the dataKey, but I've tried :name_pt, "name_pt" and ":name_pt" and none work.
Any insight?I don't know if there's something wrong in your case, but FWIW, as per the "A word about react-window" from the react-virtualized
's README, I have switched to react-window
along with react-virtualized-auto-sizer
, and it has been a smooth sailing.
I also had some issues with react-virtualized
which prompted me to switch, although I don't think it was anything similar to your case.
I'm trying to use this along with material-ui and since my knowledge of frontend/javascript is very bad, I'd rather not stray away from the examples š
Material UI has an example with react_window for lists, but it's not really what I want