1

ZK Bind: Binding with getter property including parameters

asked 2015-01-08 23:40:40 +0800

enferx gravatar image enferx
13 3

updated 2015-01-09 07:34:18 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

Hi. I'm working with zk 7 mvvm approach. Currently, I want to bind a getter property with a parameter and I receive the following error:

Unable to find method [availableQuantity] with [1] parameters at [file:/D:/Inventia/Local/07-Proyectos/Lince/04-Desarrollo/Repository/branches/master/src/lince-ui-web/lince-ui-web/src/main/webapp/views/warehouse/inventory/manage-input-inventory-movements.zul, line:349]...

Caused by: org.zkoss.zel.MethodNotFoundException: Unable to find method [availableQuantity] with [1] parameters
    at org.zkoss.zel.BeanELResolver.invoke(BeanELResolver.java:542) ~[zel-7.0.3.jar:7.0.3]
    at org.zkoss.zel.CompositeELResolver.invoke(CompositeELResolver.java:154) ~[zel-7.0.3.jar:7.0.3]
    at org.zkoss.xel.zel.XelELResolver.invoke(XelELResolver.java:148) ~[zcommon-7.0.3.jar:7.0.3]
    at org.zkoss.zel.impl.parser.AstValue.getValue(AstValue.java:166) ~[zel-7.0.3.jar:7.0.3]
    at org.zkoss.zel.impl.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184) ~[zel-7.0.3.jar:7.0.3]
    at org.zkoss.xel.zel.ELXelExpression.evaluate(ELXelExpression.java:40) ~[zcommon-7.0.3.jar:7.0.3]
    at org.zkoss.bind.impl.BindEvaluatorXImpl.getValue(BindEvaluatorXImpl.java:46) ~[zkbind-7.0.3.jar:7.0.3]

Here is my view block extract:

<groupbox form="@id('fx') @load(vm) @save(vm.inventoryMovementToolItems, before={'save', 'addToolInventoryItem', 'markManagedInstanceAsDirty'}) @validator(vm.inventoryItemsValidator)">
    <caption                    label="${labels.feature.manageInputInventoryMovements.tool.title}" />
    <grid hflex="1"                         model="@bind(fx.inventoryMovementToolItems)">
        .....

        <cell>
            <intbox hflex="1" readonly="true"         value="**@load(each.inventoryItem.material.availableQuantity(vm.managedInstance.warehouse))**">
            </intbox>
        </cell> 
    ....

vm.managedInstance is the instance being managed in a Crud operation and availableQuantity is a getter property which calculates a value based on the passed parameter. Any ideas how to solve it?. Thanks in advance!

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2015-01-09 07:37:01 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

updated 2015-01-09 07:52:07 +0800

It's simpel.

You have to call the fully name of the getter cause you are using the (). each.inventoryItem is a shortcut for each.getInventoryItem().

Solution :

value="@load(each.inventoryItem.material.getAvailableQuantity(vm.managedInstance.warehouse))">

Greetz chill.

link publish delete flag offensive edit

Comments

+1 Chill. This is a very nice but overlooked feature of the framework

cyiannoulis ( 2015-01-09 09:48:39 +0800 )edit

thx @cyiannoulis

chillworld ( 2015-01-09 09:57:48 +0800 )edit

Thx!. It works as expected!

enferx ( 2015-01-10 20:04:59 +0800 )edit
0

answered 2015-11-23 09:26:15 +0800

WilliamB gravatar image WilliamB
1609 1 6

Tried doing that with passing the forEachStatus.index but couldn't get it to work.

link publish delete flag offensive edit

Comments

what's the error william?

chillworld ( 2015-11-23 10:11:00 +0800 )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: 2015-01-08 23:40:40 +0800

Seen: 78 times

Last updated: Nov 23 '15

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