0

Zk 6.5.3 binding with composer using E.L

asked 2017-11-16 06:36:55 +0800

javiut gravatar image javiut flag of Venezuela, Bolivarian Republic of
86 1 5

i am using this code. Which is working very good.

<window id="win" xmlns:w="http://www.zkoss.org/2005/zk/client" apply='MyComposer'>
<textbox value="@{$composer.student.name}"/>

But i want to use something like this

<cell width='$composer.fullWidth?"70%":"50%"'>

in my composer i have a boolean fullWidth with the proper getter but i cannot reference it with the composer i have try a lot but nothing seems to work please help me out...

I have try

<cell width='@{$composer.fullWidth}?"70%":"50%"'>
<cell width='{$composer.fullWidth}?"70%":"50%"'>
<cell width='@{composer.fullWidth}?"70%":"50%"'>

Please help me.

Another question if i have a code like this

<textbox id='test' if='expression'/>

How can i the or use the if using Java code?? Is not possible??

Something like

test.setIf(boolean???????)

Sorry if the question is simple thanks a lot and best regards from Venezuela.....

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-11-22 20:25:24 +0800

cor3000 gravatar image cor3000
3484 1 7
ZK Team

updated 2017-11-22 20:27:35 +0800

the '?:' operator should be part of the expression: please try this:

<cell width="${$composer.fullWidth ? '70%' : '50%'}">

or

<cell width="@{$composer.fullWidth ? '70%' : '50%'}">

The special if-attribute controls whether a component is created or not. If the condition is false the component is never created at all.

The equivalent in java would be:

//remove a component
test.detach();

//re-attach the component
test.setParent(parent);

//create a new component
Textbox test = new Textbox();
test.setId(test);
test.setParent(parent);
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

Follow
1 follower

RSS

Stats

Asked: 2017-11-16 06:36:55 +0800

Seen: 4 times

Last updated: Nov 22