aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2017-11-04 12:55:13 +0100
committerRobert Jaros <rjaros@finn.pl>2017-11-04 12:55:13 +0100
commitd7b5638e6dee2081574d6229a6c629a7d50b4bd5 (patch)
tree6d7e0e64af59a897e2e299d0935aac11ce93315b /src
parent1a41c5d06bb51907b752afa9c13c08dd1e82455a (diff)
downloadkvision-d7b5638e6dee2081574d6229a6c629a7d50b4bd5.tar.gz
kvision-d7b5638e6dee2081574d6229a6c629a7d50b4bd5.tar.bz2
kvision-d7b5638e6dee2081574d6229a6c629a7d50b4bd5.zip
showOptions, hideOptions and toggleOptions methods for Select and SelectInput
Diffstat (limited to 'src')
-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)