Created
October 11, 2011 00:13
-
-
Save zippy/1276936 to your computer and use it in GitHub Desktop.
clojurescript and goog.ui.select
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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"> </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