diff options
author | Robert Jaros <rjaros@finn.pl> | 2017-11-06 12:13:52 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2017-11-06 12:13:52 +0100 |
commit | 5195caf0405eea7a6b34f60cb0a1bea3026bac3c (patch) | |
tree | 1d2852dbee080bbd00a14b78e55c9d78e372c89d /src/main/kotlin/pl/treksoft/kvision/Showcase.kt | |
parent | 1c742ec958a043519e58dcf53bb3b3c92bf3e94a (diff) | |
download | kvision-5195caf0405eea7a6b34f60cb0a1bea3026bac3c.tar.gz kvision-5195caf0405eea7a6b34f60cb0a1bea3026bac3c.tar.bz2 kvision-5195caf0405eea7a6b34f60cb0a1bea3026bac3c.zip |
Ajax support for Select, emptyOption support
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/Showcase.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/Showcase.kt | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt index 985f9f98..a3fec251 100644 --- a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt +++ b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt @@ -187,6 +187,36 @@ class Showcase : ApplicationBase() { } root.add(select7) + val select8 = Select(label = "Wybierz repozytorium").apply { + emptyOption = true + ajaxOptions = AjaxOptions("https://api.github.com/search/repositories", processData = { + it.items.map { item -> + obj { + this.value = item.id + this.text = item.name + this.data = obj { + this.subtext = item.owner.login + } + } + } + }, processParams = obj { + q = "{{{q}}}" + }, minLength = 3, requestDelay = 1000) + setEventListener<Select> { + change = { _ -> + println(self.value) + } + } + } + root.add(select8) + val mbuttons8 = Button("Sprawdz repozytorium").setEventListener<Button> { + click = { + println(select8.value) + select8.value = null + } + } + root.add(mbuttons8) + val container = SimplePanel(setOf("abc", "def")) val h1 = Tag(H1, "To jest <i>test pisania</i> tekstu", false, null, classes = setOf("test", "test2")) container.add(h1) |