@darksu, if you read mine post you see that I use also empty vm.selected
The empty at the end is cause I call the java method isEmpty()
of a list. As also said in the note where I tell how you can bypass the error.
-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all,
I'm working on mine new project with zk 7.0.0
Now I need to set a button disabled on 3 requirements :
checkmark="true" multiple="true"
=> must be a selection.(multipleSelectionListModel)Note : the names are changed for simplicity.
So I created the following :
<button label="Do something" onClick="@command('commandName')" disabled="@load((vm.dropListModel.empty) || (empty vm.selectedType) || (vm.multipleSelectionListModel.selection.empty))" />
Error :
Org.zkoss.zel.impl.parser.ParseException: Encountered " "empty" "empty "" at line 1, column 24.<|Was expecting:<| <IDENTIFIER> ...<|
at org.zkoss.zel.impl.parser.ELParser.generateParseException(ELParser.java:2215)
Changed it to :
<button label="Do something" onClick="@command('commandName')" disabled="@load(vm.dropListModel.empty)"/>
Created same error.
Created fiddle :http://zkfiddle.org/sample/3kvld74/29-parsing-error
I use a List here but List as ListModelList has the method isEmpty.
I'm not looking for a work around, I'm just reporting this issue.
Possible work around is creating a method in the viewmodel or for the fiddle :
disabled="@load(vm.items.size() eq 0)"
or : disabled="@load(vm.items.isEmpty())"
greetz chill.
the EL syntax is quite particular when it comes to lists ... also 'empty' is an operator not expected as a property name.
Simply use @load(empty vm.items)
Quote from: http://docs.oracle.com/javaee/6/tutorial/doc/bnahu.html
If you are accessing an item in an array or list, you must use either a literal value that can be converted to int or the [] notation with an int and without quotes
In fact ListModelList implements the List interface so you can't access other properties directly. Unfortunately that's a limitation of EL expressions in general.
If your model implementation doesn't implement the List interface such as ListModelSet you can access the isEmpty method using: @load(myset['empty'])
- still @load(empty myset)
looks more consistent.
Robert
Hello chillworld,
At the following url you can find some good example on EL Expressions:
http://books.zkoss.org/wiki/ZKDeveloper'sReference/MVVM/DataBinding/ELExpression
In your case please use the example <groupbox visible="@load(not empty vm.selected)"
and modify it accordingly.
Else you could write some simple java code in order to check the variables.
Best Regards,
Darksu
@darksu, if you read mine post you see that I use also empty vm.selected
The empty at the end is cause I call the java method isEmpty()
of a list. As also said in the note where I tell how you can bypass the error.
Asked: 2014-11-06 08:03:22 +0800
Seen: 78 times
Last updated: Mar 22 '17