Not send parameters via command from native table. MVVM

asked 2016-05-02 06:29:26 +0800

dmmax gravatar image dmmax
13 3

updated 2016-05-03 12:50:57 +0800

I have some problem with send parameters via @command.


<?init class="org.zkoss.zk.ui.util.Composition" arg0="layout/template.zul"?>
<div self="@define(content)" sclass="container" xmlns:n="native">
    <div sclass="row" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('dec.cwf.pageCtrl.Test2Ctrl')">
        <div sclass="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <div sclass="panel panel-default">
                <div sclass="panel-heading">
                            Список задач
                <listbox model="@bind(vm.itemsWF)">
                        <listheader label="Subject" />
                        <listheader label="Date finish" />
                        <listheader label="Action" />
                    <template name="model">
                            <listcell label="@bind(each.subject)" />
                            <listcell label="@bind(each.convertDate)" />
                                <button label="ShowPDF" onClick="@command('show', wf=each)"/>
                <n:table  class="table table-condensed table-hover">
                            <n:th>Date finish</n:th>
                    <n:tbody >
                        <div id="divRow" children="@bind(vm.itemsWF) @template('model')">
                            <template name="model">
                                        <label value="@bind(forEachStatus.index+1)" />
                                        <label value="@bind(each.subject)" />
                                        <label value="new" sclass="badge badge-info" visible="@bind(each.isNew?'true':'false')" />
                                        <label value="@bind(each.convertDate)" />
                                        <button label="ShowPDF" onClick="@command('show',wf=each)" />

And Java class:

public class Test2Ctrl
    private ListModelList itemsWF;

    public void init()
        WorkflowService wfService = new WorkflowTestImpl();
        itemsWF = new ListModelList<>(wfService.getAllByUserId(null));

    public void show(@BindingParam("wf") WorkflowModel wf)
        System.out.println("wf: " + wf==null?"null":wf.toString());
        System.out.println("wfSubject: " + wf.getSubject()==null?"null":wf.getSubject());

    public ListModelList getItemsWF()
        return itemsWF;

    public void setItemsWF(ListModelList itemsWF)
        this.itemsWF = itemsWF;


ZK 7.0.3:

Filling data work fine in listbox and n:table, but when I clicked on btn (showPDF), Listbox's btn send the parameters wf, but n:table's btn not send the parameters. I don't know why, I think problem with n:table not has property 'model'.

ZK 8.x.x.x:

Filling data not work, I have some exception:

java.lang.AbstractMethodError: org.zkoss.zkmax.bind.impl.TrackerNodeImplEx.getDependents(Ljava/lang/Object;)Ljava/util/Set;
    at org.zkoss.bind.tracker.impl.TrackerImpl.tieValue(TrackerImpl.java:320)
    at org.zkoss.bind.xel.zel.BindELResolver.tieValue(BindELResolver.java:274)
    at org.zkoss.bind.xel.zel.BindELResolver.getValue(BindELResolver.java:146)
    at org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:188)
    at org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    at org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:41)
    at org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:47)
    at org.zkoss.bind.impl.LoadPropertyBindingImpl.load(LoadPropertyBindingImpl.java:58)
    at org.zkoss.bind.impl.PropertyBindingHandler.doLoadBinding(PropertyBindingHandler.java:133)
    at org.zkoss.bind.impl.PropertyBindingHandler.doLoad(PropertyBindingHandler.java:334)
    at org.zkoss.bind.impl.BinderImpl.loadComponentProperties0(BinderImpl.java:2321)
    at org.zkoss.bind.impl.BinderImpl.loadComponent0(BinderImpl.java:2288)
    at org.zkoss.bind.impl.BinderImpl.loadComponent0(BinderImpl.java:2293)
    at org.zkoss.bind.impl.BinderImpl.loadComponent0(BinderImpl.java:2293)
    at org.zkoss.bind.impl.BinderImpl.loadComponent0(BinderImpl.java:2293)
    at org.zkoss.bind.impl.BinderImpl.loadComponent(BinderImpl.java:2227)
    at org.zkoss.bind.BindComposer$BinderKeeper$Loader.load(BindComposer.java:575)
    at org.zkoss.bind.BindComposer$BinderKeeper.loadComponentForAllBinders(BindComposer.java:551)
    at org.zkoss.bind.BindComposer.doAfterCompose(BindComposer.java:190)

Could anyone give any idea on how to solve it?

=========== That's my fault.

I have transient dependencies of zk 7, this is because you add the org.zkoss.addons. Change the pom to :

delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted

answered 2016-05-02 07:20:42 +0800

chillworld gravatar image chillworld flag of Belgium
5337 4 9

I created a fiddle with your code : http://zkfiddle.org/sample/9pe0q5/1-filling-data and I'm not able to reproduce your problem in ZK 8.

Try to debug what the problem actually is, but I suggest to change your name of the second template, so it doesn't match the first templates name.
If your able to reproduce the problem in fiddle, I can look further.

Greetz chill.

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




Asked: 2016-05-02 06:29:26 +0800

Seen: 40 times

Last updated: May 03 '16

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