-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello
I have the a tree which I am displaying with the following zul:
<tree id="salesorderTree" rows="0" width="100%" model="@bind(vm.salesorderTreeModel) @template(not empty each.children ? 'product' : 'detail')">
<treecols sizable="true">
<treecol hflex="24" label="Varelinjer"/>
</treecols>
<template name="product" var="productNode" status="spn">
<treeitem>
<treerow>
<treecell label="@load(productNode.data.description)"/>
</treerow>
</treeitem>
</template>
<template name="detail" var="detailNode" status="sdn">
<treeitem>
<treerow>
<treecell label="@load(detailNode.data.salesorderDetailId)"/>
</treerow>
</treeitem>
</template>
</tree>
This will output a simple tree with this layout:
root product 1 product detail product detail product 2 product detail
and so forth.
This is fine but the problem is when I remove all product details on a product I get an error:
Property 'salesorderDetailId' not found on type no.tisaksen.zk.tree.SalesorderProduct Property 'quantity' not found on type no.tisaksen.zk.tree.SalesorderProduct
This means it's actually trying to render the "detail" template when the detail is in fact not there anymore.
Anyone know how to solve this? Or maybe can see what I'm doing wrong?
Asked: 2013-03-12 07:38:19 +0800
Seen: 15 times
Last updated: Mar 12 '13
in you code
dennis ( 2013-03-12 11:10:31 +0800 )editnot empty each.children ? 'product' : 'detail'
, so if you remove all the children of product then goes to 'detail', doesn't it?you have to has a way to determine the node is a product or not, shouldn't depend on children.Oh right, I see the problem. Maybe I can just use isLeaf (since these are TreeNode's anyway) so it will be @template(each.leaf ? 'detail' : 'product')
tisaksen ( 2013-03-12 12:22:10 +0800 )edit