Ilya Tel
01/28/2023, 4:13 PMrefreshOnUpdate? I read the documentation and saw only `override fun buildClassSet(classSetBuilder: ClassSetBuilder)`use case.
For example, сan it interact with rendering ? (not working):
class Example(ids: List<Long>): SimplePanel() {
var myIds by refreshOnUpdate(ids)
init {
button("${myIds}") {//interact somehow
onClickLaunch { myIds = listOf(2L) }
}
}
}
2. What if I have a component where models comes as an argument models: ObservableValue<List<Order>>.
Inside I create val pagination: ObservableValue<Pagination>
Next, I want to have a div that will change when the models changes or when the pagination changes. I can't figure out how to achieve this now.
For example, I can't put models and pagination in val state: ObservableValue<SomeState>
because models are being updated in another component, but the rerender will only happen when the state changes state.setValue(state.value.apply{})Robert Jaros
01/28/2023, 4:40 PMrefreshOnUpdate delegate lets you easily declare properties, which change how the component should be rendered (what element is rendered and what attributes, classes and styles are applied to it). When used, it will re-render the component when the value is set. In general you don't need to use refreshOnUpdate, unless you are implementing some kind of advanced component.Robert Jaros
01/28/2023, 4:49 PMmyIds variable changes. It's child component does (but the init {} block is not called on re-rendering).Robert Jaros
01/28/2023, 4:50 PMclass Example(ids: List<Long>): SimplePanel() {
var myIds = ids
set(value) {
field = value
button.text = "$value"
}
private val button: Button
init {
button = button("$ids") {//interact somehow
onClick { myIds = listOf(2L) }
}
}
}Ilya Tel
01/28/2023, 4:53 PMObservableValueRobert Jaros
01/28/2023, 4:55 PMRefreshOnUpdate when you are overrding methods like render, buildClassSet, buildAttributesSet, childrenVNodes,Robert Jaros
01/28/2023, 4:56 PMRobert Jaros
01/28/2023, 4:57 PMIlya Tel
01/28/2023, 4:58 PMRobert Jaros
01/28/2023, 5:01 PMRobert Jaros
01/28/2023, 5:03 PMbind with a sub parameter.Robert Jaros
01/28/2023, 5:04 PMIlya Tel
01/28/2023, 5:05 PMRobert Jaros
01/28/2023, 5:07 PMIlya Tel
01/28/2023, 5:10 PMRobert Jaros
01/28/2023, 5:10 PMRobert Jaros
01/28/2023, 5:11 PMRobert Jaros
01/28/2023, 5:15 PM