Permalink
Browse files

One more example for the Search module

  • Loading branch information...
sadhen committed Jan 1, 2017
1 parent 074682b commit 454d5685fdf0bebdbdc63609505425d807e7e44e
@@ -12,7 +12,6 @@ import scala.scalajs.js
import scala.scalajs.js.JSON
object ScalaJSExample extends js.JSApp {
@@ -31,8 +30,16 @@ object ScalaJSExample extends js.JSApp {
@dom
def render = {
val data = Var("")
val input = <input class="prompt" type="text" placeholder="Search countries..." />
countRequest(data) // initial population
<div>
<div class="ui search">
<div class="ui icon input">
{ input }
<i class="search icon"></i>
</div>
<div class="results"></div>
</div>
<select class="ui search dropdown">
<option>State</option>
<option value="AL">Alabama</option>
@@ -49,6 +56,13 @@ object ScalaJSExample extends js.JSApp {
def main(): Unit = {
dom.render(document.body, render)
import SemanticUI.jq2semantic
//import js.JSConverters._
//val content = List("China", "Canada", "USA")
// .map(country => mutable.HashMap("title" -> country).toJSDictionary)
// .toJSArray
val content = js.Array("China", "Canada", "USA")
.map(country => js.Dictionary("title" -> country))
jQuery(".ui.search").search(js.Dynamic.literal(source = content))
jQuery(".ui.dropdown").dropdown(js.Dynamic.literal(on = "hover"))
}
}
@@ -11,6 +11,7 @@ object SemanticUI {
@js.native
trait SemanticJQuery extends JQuery {
def dropdown(params: js.Any*): SemanticJQuery = js.native
def search(params: js.Any*): SemanticJQuery = js.native
}
implicit def jq2semantic(jq: JQuery): SemanticJQuery = jq.asInstanceOf[SemanticJQuery]

0 comments on commit 454d568

Please sign in to comment.