This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-02
Channels
- # announcements (13)
- # babashka (42)
- # beginners (29)
- # calva (39)
- # cider (15)
- # clerk (10)
- # clojure (67)
- # clojure-europe (18)
- # clojure-hungary (2)
- # clojure-nl (1)
- # clojure-norway (12)
- # clojure-uk (7)
- # clojuredesign-podcast (14)
- # clojurescript (19)
- # datalevin (1)
- # datascript (5)
- # emacs (4)
- # events (2)
- # fulcro (5)
- # graalvm (5)
- # hyperfiddle (23)
- # incanter (3)
- # jobs (2)
- # lsp (8)
- # missionary (15)
- # off-topic (45)
- # portal (41)
- # practicalli (1)
- # re-frame (3)
- # reitit (6)
- # releases (2)
- # remote-jobs (1)
- # sci (1)
- # shadow-cljs (35)
- # solo-full-stack (8)
- # tools-deps (4)
Hello! I am not able to work this code Can anyone take a look please.? -->
(js->clj (.getElementsByTagName js/document "tr") :keywordize-keys true)
it is retuns to me: "[Object HTMLCollection]"
You can see my table here:
https://gist.github.com/Bariscanates404/4992ef969eccba965ec348838371bf0bjs->clj
only works with plain objects and some specific types.
The type returned by getElementsByTagName
is HTMLCollection
and it's not handled by js->clj
.
Oh, don't manipulate the DOM directly then.
I'm not sure what the dom
alias is in your code, but it's much better to handle such things at the level of the UI library.
I using Hyperfiddle Electric, Which is why things getting much harder than normal, I can find some examples of standard Clojurescript usage but sometimes I am not able to use them in Electric.
E.g. in Reagent your data drives the UI. So in order to reorder a table you'd just reorder the data.
Nice idea, I can try to do that in Electric. My table data comes from a query, if I sort query maybe I can able to sort table.
Well, then you'd have to re-request the data. If it'll be the same data just in different order, I'd reorder it with some CLJS code without issuing a new request. No clue whether it's possible in Electric since I don't use it.
I'd say one of the value propositions of Electric is that you don't need to think about client versus server state. So I would expect implementing your query with a kind of "sorting parameter" should do the trick 🙂 Sorting client-side would be an optimization, which I'd avoid unless the query was expensive
Thanks for sharing your time, I am going to try @U2FRKM4TW and @U052XLL3A yours advices. 🙂
Sorry to ask such a simple question, but I figured it might save time asking here rather than testing with trial and error…
Does definline
get treated similarly to a macro in ClojureScript? i.e. do I need to put it in a separate file?
there is no definline
in CLJS, we do have “inlining” macros, i.e. that’s how we generate primitive +
when you use cljs.core/+