Skip to content

Instantly share code, notes, and snippets.

@charles-dyfis-net
Created July 6, 2012 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charles-dyfis-net/28671a8faefeb1451c4b to your computer and use it in GitHub Desktop.
Save charles-dyfis-net/28671a8faefeb1451c4b to your computer and use it in GitHub Desktop.
;;; ...the method...
(defn build [grid-atom source-atom source-func selector
& {:keys [columns-fn columns options]}]
(if (nil? @grid-atom)
(let [columns-val (or (and columns-fn (columns-fn @source-atom))
columns)]
(reset! grid-atom
{:grid-obj (new js/Slick.Grid selector
(clj->js (source-func @source-atom))
(clj->js columns-val)
(clj->js (or options {})))
:selector selector
:columns columns-val
:columns-fn columns-fn
:options options})
(add-watch source-atom selector
(fn [key ref old new]
(update grid-atom ref source-func new))))
(update grid-atom source-atom source-func)))
;;; ...called as...
(grid/build grid-obj grid-data get-grid-data "#phase1-grid"
:columns grid-columns
:options grid-options)
;;; ...yields the warning...
; WARNING: Wrong number of args (8) passed to releng.ui.grid/build at line 85 src/main/clojurescript/releng/create/phase1.cljs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment