Revision history [back]

click to hide/show revision 1
initial version

answered 2013-08-05 09:27:37 +0800

cor3000 gravatar image cor3000

ZK Team

Hi EBlues,

this example works for me using ZK 6.5.3 EE ...

<zk>
    <div apply="org.zkoss.bind.BindComposer"  viewModel="@id('vm') @init('zk.support.listmodel.ListModelClearTest')">
        <button label="clear list" onClick="@command('clear')" />
        <button label="fill list" onClick="@command('fill')" />
        <listbox model="@load(vm.model)">
            <template name="model">
                <listitem>
                    <listcell label="@load(each)"></listcell>
                </listitem>
            </template>
        </listbox>
    </div>
</zk>

and viewmodel

package zk.support.listmodel;

import org.zkoss.bind.annotation.Command; import org.zkoss.zul.ListModelList;

public class ListModelClearTest {

private ListModelList<String> model = new ListModelList<String>(new String[] {"item1", "item2"});

public ListModelList<String> getModel() {
    return model;
}

@Command("clear")
public void clear() {
    model.clear();
}

@Command("fill")
public void fill() {
    model.add("newitem1");
    model.add("newitem2");
    model.add("newitem3");
}

}

can you provide an example to reproduce together with the zk-version/edition used?

Cheers, Robert

Hi EBlues,

this example works for me using ZK 6.5.3 EE ...

<zk>
    <div apply="org.zkoss.bind.BindComposer"  viewModel="@id('vm') @init('zk.support.listmodel.ListModelClearTest')">
        <button label="clear list" onClick="@command('clear')" />
        <button label="fill list" onClick="@command('fill')" />
        <listbox model="@load(vm.model)">
            <template name="model">
                <listitem>
                    <listcell label="@load(each)"></listcell>
                </listitem>
            </template>
        </listbox>
    </div>
</zk>

and viewmodel

package zk.support.listmodel;

zk.support.listmodel; import org.zkoss.bind.annotation.Command; import org.zkoss.zul.ListModelList;

org.zkoss.zul.ListModelList; public class ListModelClearTest {

{

    private ListModelList<String> model = new ListModelList<String>(new String[] {"item1", "item2"});

 public ListModelList<String> getModel() {
     return model;
 }

 @Command("clear")
 public void clear() {
     model.clear();
 }

 @Command("fill")
 public void fill() {
     model.add("newitem1");
     model.add("newitem2");
     model.add("newitem3");
    }
}

}

can you provide an example to reproduce together with the zk-version/edition used?

Cheers, Robert

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