From 5195caf0405eea7a6b34f60cb0a1bea3026bac3c Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Mon, 6 Nov 2017 12:13:52 +0100 Subject: Ajax support for Select, emptyOption support --- src/main/kotlin/pl/treksoft/kvision/Showcase.kt | 30 ++++++++++++++++++++ .../kotlin/pl/treksoft/kvision/core/KVManager.kt | 4 +++ .../pl/treksoft/kvision/form/select/AjaxOptions.kt | 33 ++++++++++++++++++---- .../pl/treksoft/kvision/form/select/Select.kt | 15 ++++++++-- .../pl/treksoft/kvision/form/select/SelectInput.kt | 30 ++++++++++++-------- 5 files changed, 93 insertions(+), 19 deletions(-) (limited to 'src/main/kotlin') 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