diff options
author | Robert Jaros <rjaros@finn.pl> | 2017-11-06 00:20:25 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2017-11-06 00:20:25 +0100 |
commit | 1c742ec958a043519e58dcf53bb3b3c92bf3e94a (patch) | |
tree | 0d4804a58b0a59f28029c8f65897caf70e4ade35 /src/main/kotlin/pl/treksoft/kvision/Showcase.kt | |
parent | 2b0f687b17bdf0144262a20556446cfbf50a4f34 (diff) | |
download | kvision-1c742ec958a043519e58dcf53bb3b3c92bf3e94a.tar.gz kvision-1c742ec958a043519e58dcf53bb3b3c92bf3e94a.tar.bz2 kvision-1c742ec958a043519e58dcf53bb3b3c92bf3e94a.zip |
Ajax support for SelectInput
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/Showcase.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/Showcase.kt | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt index 7ff2f1fe..985f9f98 100644 --- a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt +++ b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt @@ -7,7 +7,19 @@ import pl.treksoft.kvision.data.DataComponent import pl.treksoft.kvision.data.DataContainer import pl.treksoft.kvision.dropdown.DD.* import pl.treksoft.kvision.dropdown.DropDown -import pl.treksoft.kvision.form.* +import pl.treksoft.kvision.form.CheckBox +import pl.treksoft.kvision.form.INPUTSIZE +import pl.treksoft.kvision.form.TEXTINPUTTYPE +import pl.treksoft.kvision.form.Text +import pl.treksoft.kvision.form.TextArea +import pl.treksoft.kvision.form.TextAreaInput +import pl.treksoft.kvision.form.TextInput +import pl.treksoft.kvision.form.select.AjaxOptions +import pl.treksoft.kvision.form.select.SELECTWIDTHTYPE +import pl.treksoft.kvision.form.select.Select +import pl.treksoft.kvision.form.select.SelectInput +import pl.treksoft.kvision.form.select.SelectOptGroup +import pl.treksoft.kvision.form.select.SelectOption import pl.treksoft.kvision.html.* import pl.treksoft.kvision.html.TAG.DIV import pl.treksoft.kvision.html.TAG.H1 @@ -16,6 +28,7 @@ import pl.treksoft.kvision.modal.Confirm import pl.treksoft.kvision.modal.Modal import pl.treksoft.kvision.panel.* import pl.treksoft.kvision.routing.routing +import pl.treksoft.kvision.snabbdom.obj import pl.treksoft.kvision.utils.perc import pl.treksoft.kvision.utils.px @@ -134,13 +147,13 @@ class Showcase : ApplicationBase() { hiddenBsSelect = { e -> println("hidden") } - renderedBsSelect= { e -> + renderedBsSelect = { e -> println("rendered") } refreshedBsSelect = { e -> println("refreshed") } - loadedBsSelect= { e -> + loadedBsSelect = { e -> println("loaded") } changedBsSelect = { e -> @@ -157,6 +170,23 @@ class Showcase : ApplicationBase() { } root.add(select6) + val select7 = SelectInput().apply { + 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}}}" + }) + } + root.add(select7) + 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) |