How to execute java method after listbox model is set?

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

imosescu gravatar image imosescu

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

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

gganassin gravatar image gganassin flag of Luxembourg
540 6

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


<?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'}">
            <listheader label="Value" />

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.


link publish delete flag offensive edit

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

Darksu gravatar image Darksu
1991 1 4

Hello imosescu,

This is how is do it:

    public void compose() {

        model = new ListModelList<>();




Hope it helps.

Best Regards,


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

Seen: 21 times

Last updated: Feb 17 '16

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