0

Conditional Template and GroupModel not working.

asked 2014-12-08 12:36:35 +0800

tisaksen gravatar image tisaksen
46 6

I have a problem with conditional templates and GroupModel

<grid id="theGrid" model="@bind(vm.myObjectViewModel) @template(not empty vmsgs ? 'templateA' : 'templateB')" emptyMessage="No data">
<columns>
    <column width="50%" label="Description" sort="auto"/>
    <column width="50%" label="Value"/>
</columns>
<!--
<template name="model:group">
    <group label="whatever"/>
</template>-->
<template name="templateA:group">
    <group label="Group A"/>
</template>
<template name="templateB:group">
    <group label="Group B"/>
</template>
<template name="templateA" var="a">
    <row>
        <label value="@load(a.description)"/>
        <label value="@load(a.value)" />
    </row>
</template>
<template name="templateB" var="b">
    <row>
        <label value="@load(b.description)" style="font-size: 14pt; color: red;"/>
        <label value="@load(b.value)"/>
    </row>
</template></grid>

Property 'description' not found on type java.lang.String at [file:/C:/Oracle/Middleware/userprojects/domains/dev/servers/Development1/tmp/WL_user/myapp/806lrv/war/myobjectview.zul, line:36]

For some reason the selected template is also being used by zkoss for getting/setting the group name. Neither of my :group templates are working ,and even it doesn't work if I put in the "default" group template "model:group" (currently commented out)

The object being loaded is "MyObject" which has the following properties:

String description BigDecimal value

Any ideas?

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2014-12-08 15:15:16 +0800

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

@Zk Please check this out. Suspect bug here.

http://zkfiddle.org/sample/23op11h/4-gridgroup-dynamic-template-group-header

Greetz chill.

link publish delete flag offensive edit

answered 2014-12-09 02:52:55 +0800

cor3000 gravatar image cor3000
6280 2 7

removed the @template('model:group') doesn't make sense. Then the list looks correct. (or am I missing something) @Chill: http://zkfiddle.org/sample/23op11h/6-gridgroup-dynamic-template-group-header

link publish delete flag offensive edit

answered 2014-12-09 03:07:50 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2014-12-09 03:08:29 +0800

@tisaksen: your findings look like a bug I check if I can simplify and post a bug http://zkfiddle.org/sample/23op11h/8-gridgroup-dynamic-template-group-header

link publish delete flag offensive edit

answered 2014-12-09 04:11:55 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2014-12-09 04:13:38 +0800

I posted the Bug: http://tracker.zkoss.org/browse/ZK-2555 together with a simpler way to reproduce the issue and a patch for the org.zkoss.bind.impl.BindRowRenderer class

link publish delete flag offensive edit

answered 2014-12-09 05:24:03 +0800

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

updated 2014-12-09 06:12:02 +0800

@Cor I know it doesn't make sense but was to simplify it. (was thinking to point out to the header first because the name of template didn't work either)

Greetz chill.

link publish delete flag offensive edit

answered 2014-12-09 07:30:15 +0800

tisaksen gravatar image tisaksen
46 6

That's great Cor, thanks a lot! I will definitely use the patch.

link publish delete flag offensive edit
Your reply
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: 2014-12-08 12:36:35 +0800

Seen: 33 times

Last updated: Dec 09 '14

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