0

Order of @load bindings causes issue

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

JustinFrost gravatar image JustinFrost
133 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()){
                c.setFocus();
                break;
            }
        }
    }
}

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)"/>
</formComponent>

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.

Thanks.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Follow
1 follower

RSS

Stats

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

Seen: 27 times

Last updated: May 08

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