https://kotlinlang.org logo
s

Slackbot

06/07/2021, 11:07 PM
This message was deleted.
h

Hywel Bennett

06/07/2021, 11:07 PM
I may be mis-reading the code, but it seems like the FormPanel renders all fields first, then any other components (spans, divs etc) below. This seems to be because SimplePanel has the following implementation of childrenVNodes():
Copy code
protected open fun childrenVNodes(): Array<VNode> {
        return (privateChildren + children).filter { it.visible }.map { it.renderVNode() }.toTypedArray()
    }
So I can't put a link, for example, below text inputs to direct the user to help etc, as that will not be rendered in-place, but rather at the end of the form panel
I suppose I can make my own Control sub-class which contains the help text widgets etc, which is almost certainly what I should be doing 😄
r

Robert Jaros

06/08/2021, 7:14 AM
I don't see the question which started this thread, but FormPanel definitely doesn't render fields first. You can mix form fields with other components.
h

Hywel Bennett

06/08/2021, 7:29 AM
Sorry I thought I deleted it the thread. I'm not sure why I'm seeing what I'm seeing then. I may come back with an example later but it feels like a single control would better encapsulate things anyway.
Aha, it's the use of the fieldset legend. Fields will get added to the current fieldset, but other components won't, so will render below the fieldset.
It would seem nicer if I could add my own fieldsets to the formPanel, but I understand this may be hard
r

Robert Jaros

06/08/2021, 9:14 AM
You can. There is new type of form bindings, which I actually prefer (
bind
instead of
add
). It will be probably the only binding in KVision 5.x. Look here: https://github.com/rjaros/tricity-example/blob/main/src/frontendMain/kotlin/com/example/project/App.kt#L58
h

Hywel Bennett

06/08/2021, 9:15 AM
You continue to impress me 🙂 I also just started using the Spring Boot service bindings and it's a dream. Truly a big step forward in front/backend interaction.