Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (def columns
- [{:title "Name"
- :data "name"}
- {:title "Age"
- :data "age"}])
- (def data
- [{"name" "Matthew"
- "age" "26"}
- {"name" "Anna"
- "age" "24"}
- {"name" "Michelle"
- "age" "42"}
- {"name" "Frank"
- "age" "46"}])
- (defn home-render []
- [:div
- [:table.ui.celled.table
- {:ref "main" :width "100%"}]])
- (defn home-did-mount [this]
- (.DataTable
- (-> this .-refs .-main js/$)
- (clj->js
- {:columns columns
- :data data
- :responsive true})))
- (defn home-will-unmount [this]
- (.destroy
- (.DataTable
- (.find
- (js/$ ".dataTables_wrapper")
- "table"))
- true))
- (defn home []
- (r/create-class
- {:reagent-render home-render
- :component-did-mount home-did-mount
- :component-will-unmount home-will-unmount
- :should-component-update (fn [& args] false)}))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement