clojure-quant / awesome

0 stars 0 forks source link

Reagent-table #8

Closed awb99 closed 6 months ago

awb99 commented 11 months ago

https://github.com/Frozenlock/reagent-table

awb99 commented 11 months ago

def columns [{:path [:Animal :Name] :header "Name" :key :Name} ; convention - use field name for reagent key {:path [:Animal :Colour] :header "Colour" :key :Colour} {:path [:Animal :Skin] :header "Skin Type" :key :Skin} {:path [:Animal :Weight] :header "Weight" :format #(format-number %) :attrs (fn [data] {:style {:text-align "right" :display "block"}}) :key :Weight} {:path [:Animal :Age] :header "Age" :attrs (fn [data] {:style {:text-align "right" :display "block"}}) :key :Age} {:path [:Animal :Hostile] :header "Hostile?" :format #(if % "Stay Away!" "OK to stroke") :key :Hostile}])

awb99 commented 11 months ago
[rt/reagent-table table-data {:table {:class "table table-hover table-striped table-bordered table-transition"
                                      :style {:border-spacing 0
                                              :border-collapse "separate"}}
                              :table-container {:style {:border "1px solid green"}}
                              :th {:style {:border "1px solid white" :background-color "black"}}
                              :table-state  table-state
                              :scroll-height "80vh"
                              :column-model columns
                              :row-key      row-key-fn
                              :render-cell  cell-fn
                              :sort         sort-fn
                              ;:caption [:caption "Test caption"]
                              :column-selection {:ul
                                               {:li {:class "btn"}}}
                              }]]
awb99 commented 11 months ago

https://launchhubstudio.com/blog/sticky-table-headers