Order of @load bindings causes issue

asked 2017-05-04 03:44:53 +0800

JustinFrost gravatar image JustinFrost
139 1 6

I have a custom form component which extends Div, in the setVisible method of this component there is some code to focus to the first element as follows:

setVisible(boolean visible){
    if (visible){    
        for (Component c: getFormComponents()){
            if (!c.getDisabled() && c.isVisible()){

The zul page using this custom component is as follows:

<formComponent visible="@load(vm.formModel.open)">
    <textbox visible="@load(vm.formModel.textType)" disabled="@load(vm.formModel.textDisabled)"/>
    <textbox visible="@load(vm.formModel.value)"/>

The issue I am having is that when the setVisible method is called as a result of notify on formModel.open the text box components have not yet been set visible/disabled because the @load binding has not yet been executed.

What order are the @load bindings executed, is there is any way to make the setVisible be executed last so it gets the correct visible and disabled values for the textboxes.


delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-08 06:44:35 +0800

barracus gravatar image barracus flag of Italy
38 4

Ciao Justin. I recommend you to use template. The first template will use a label in place of the disabled textbox. The template selection depends on open, and the component textbox got a focus="true" as attribute.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2017-05-04 03:44:53 +0800

Seen: 29 times

Last updated: May 08 '17

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More