summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/Showcase.kt1
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/Select.kt12
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/SelectInput.kt14
3 files changed, 26 insertions, 1 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt
index 41ceacd9..7ff2f1fe 100644
--- a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt
@@ -103,6 +103,7 @@ class Showcase : ApplicationBase() {
val mbuttons3 = Button("Select").setEventListener<Button> {
click = {
println(select3.value)
+ select3.toggleOptions()
}
}
root.add(mbuttons3)
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/Select.kt b/src/main/kotlin/pl/treksoft/kvision/form/Select.kt
index e099dd43..4ed04cc8 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/Select.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/Select.kt
@@ -145,4 +145,16 @@ open class Select(options: List<StringPair>? = null, value: String? = null,
override fun getChildren(): List<Widget> {
return input.getChildren()
}
+
+ open fun showOptions() {
+ input.showOptions()
+ }
+
+ open fun hideOptions() {
+ input.hideOptions()
+ }
+
+ open fun toggleOptions() {
+ input.toggleOptions()
+ }
}
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/SelectInput.kt b/src/main/kotlin/pl/treksoft/kvision/form/SelectInput.kt
index 68c3b57d..7cacd422 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/SelectInput.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/SelectInput.kt
@@ -16,7 +16,7 @@ enum class SELECTWIDTHTYPE(val value: String) {
FIT("fit")
}
-class SelectInput(options: List<StringPair>? = null, value: String? = null,
+open class SelectInput(options: List<StringPair>? = null, value: String? = null,
multiple: Boolean = false, classes: Set<String> = setOf()) : SimplePanel(classes), StringFormField {
internal var options = options
@@ -169,6 +169,18 @@ class SelectInput(options: List<StringPair>? = null, value: String? = null,
this.refreshSelectInput()
}
+ open fun showOptions() {
+ getElementJQueryD()?.selectpicker("show")
+ }
+
+ open fun hideOptions() {
+ getElementJQueryD()?.selectpicker("hide")
+ }
+
+ open fun toggleOptions() {
+ getElementJQueryD()?.selectpicker("toggle")
+ }
+
override fun getSnClass(): List<StringBoolPair> {
val cl = super.getSnClass().toMutableList()
cl.add("selectpicker" to true)