Skip to content

Instantly share code, notes, and snippets.

@zippy zippy/gist:1276936
Created Oct 11, 2011

Embed
What would you like to do?
clojurescript and goog.ui.select
(defn make-select [elem-id]
(let [select (goog.ui.Select. "Heading")
select-elem (d/element (keyword (str "div#" elem-id)))]
(.addItemAt select (goog.ui.MenuItem. "Item 1") 0)
(.addItem select (goog.ui.Option. "Item 2"))
(.render select select-elem)
select-elem
)
)
;; when you add the results of a calling the above function with:
(make-select :channel)
;; to the dom, it produces:
<div id="channel"><div class="goog-inline-block goog-menu-button" title="" role="button" style="-webkit-user-select: none; " tabindex="0" aria-haspopup="true" aria-pressed="false" aria-expanded="false" aria-activedescendant=""><div class="goog-inline-block goog-menu-button-outer-box"><div class="goog-inline-block goog-menu-button-inner-box"><div class="goog-inline-block goog-menu-button-caption">Heading</div><div class="goog-inline-block goog-menu-button-dropdown">&nbsp;</div></div></div></div></div>
;; So, where are the Items?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.