0

How to execute java method after listbox model is set?

asked 2016-02-17 13:48:43 +0800

imosescu gravatar image imosescu
1

I have a textbox :

<textbox id="tb"/>

A listbox (with a query, but it's not important):

<listbox id="someList"
model="@{query.Leftlist.childrenQuery, access='load', load-after='tb.onChange'}"/>

And a method in Java in the Controller class of the above mentioned elements:

public void doSomething() {
//do something after the listbox has finished loading
}

How do I load/execute the doSomething() method after the listbox finished loading?

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-02-17 14:32:55 +0800

gganassin gravatar image gganassin flag of Luxembourg
540 6
http://www.hybris.com/

updated 2016-02-17 14:35:22 +0800

Hello!

<zk>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="win"?>
<window id="win" title="Container Window" border="normal" apply="test01.test.TestController">
    <textbox id="tb" />
    <listbox id="lb" model="@{win$composer.dataModel, load-after='tb.onChange'}">
        <listhead>
            <listheader label="Value" />
        </listhead>
    </listbox>
</window>
</zk>

where the TextController is a simple:

public class TestController extends GenericForwardComposer {

    public ListModel<String> getDataModel() {
        System.out.println("reloading the data model...");
        return new ListModelList<String>(new String[] {"one", "two", "three"});
    }

}

Something like this? If you want to be pure MVVM instead, i think you can find good inspiration on BenBai's blog: http://ben-bai.blogspot.lu/2012/12/zk-listbox-inplace-editing-with.html where he is using a onModelDataChange custom Event in a different scenario.

Giovanni

link publish delete flag offensive edit
0

answered 2016-02-17 14:35:38 +0800

Darksu gravatar image Darksu
1991 1 4

Hello imosescu,

This is how is do it:

@AfterCompose
    public void compose() {

        //Initialize
        model = new ListModelList<>();

        retrieveData();

        executeCommand();

    }

Hope it helps.

Best Regards,

Darksu

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: 2016-02-17 13:48:43 +0800

Seen: 21 times

Last updated: Feb 17 '16

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