aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/Showcase.kt8
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt4
3 files changed, 10 insertions, 4 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt
index dfdc5b6b..d7b76862 100644
--- a/src/main/kotlin/pl/treksoft/kvision/Showcase.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/Showcase.kt
@@ -462,7 +462,13 @@ class Showcase : ApplicationBase() {
}, required = true)
add("spinner", Spinner(label = "Spinner"), required = true)
add("radiogroup", RadioGroup(listOf("o1" to "Pierwsza opcja", "o2" to "Druga opcja"),
- inline = true, label = "Radio group"), required = true)
+ inline = true, label = "Radio group").apply {
+ setEventListener<RadioGroup> {
+ change = { e ->
+ println(self.value)
+ }
+ }
+ }, required = true)
validator = {
val result = it["text"] == it["textarea"]
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
index 1a28870a..696e2264 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/Radio.kt
@@ -86,7 +86,7 @@ open class Radio(value: Boolean = false, extraValue: String? = null, label: Stri
init {
@Suppress("LeakingThis")
- input.eventTarget = this
+ input.eventTarget = this.eventTarget ?: this
this.addInternal(input)
this.addInternal(flabel)
this.addInternal(validationInfo)
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt
index 43a0d4e4..50bd49fc 100644
--- a/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/form/check/RadioGroup.kt
@@ -55,7 +55,6 @@ open class RadioGroup(options: List<StringPair>? = null, value: String? = null,
final override val validationInfo: HelpBlock = HelpBlock().apply { visible = false }
init {
- @Suppress("LeakingThis")
setChildrenFromOptions()
counter++
}
@@ -103,8 +102,9 @@ open class RadioGroup(options: List<StringPair>? = null, value: String? = null,
Radio(false, extraValue = it.first, label = it.second).apply {
inline = tinline
name = tidc
+ eventTarget = this@RadioGroup
setEventListener<Radio> {
- change = {
+ change = { e ->
this@RadioGroup.value = self.extraValue
}
}