Multi Selection Store
This store can be used for components with an internal store that has to deal with a List of some type T.
Use the toggle method to add or remove a selected item from the current selection:
val selection = MultiSelectionStore<String>()
lineUp {
items {
listOf("One", "Two", "Three", "Four", "Five").forEach { value ->
box({
background { color { info } }
}) {
+value
clicks.events.map { value } handledBy selection.toggle
// ^^^^^ ^^^^^^
// pass current value to the ``toggle`` handler!
}
}
}
}
div {
+"Selection:"
ul {
selection.data.renderEach { value ->
li { +value }
}
}
}Content copied to clipboard
RFC: Never ever expose the internal store directly to the client side! Only accept values or Flow]s and return those in order to exchange data with the client!
Constructors
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open infix fun <E : Event, X : Element> DomListener<E, X>.handledBy(handler: Handler<Unit>)
Content copied to clipboard
open infix fun <E : Event, X : Element> DomListener<E, X>.handledBy(execute: suspend (E) -> Unit): Job
Content copied to clipboard
open infix fun <E : Event> WindowListener<E>.handledBy(handler: Handler<Unit>)
Content copied to clipboard