-
FEATURED COMPONENTS
First time here? Check out the FAQ!
e.g.:<doublebox maxlength="10" mandatory="@load(something.valueRequired)" width="250px" tooltiptext="Enter Number" value="@bind(something.infoNumericValue)" placeholder="@load(something.infoData);"> </doublebox>
So,please tell me how to add `
enter with dynamic content(@load(something.infoData))`
and it is shown like enter your something
in placeholder.
You can use EL expressions for this:-
placeholder="Enter ${something.infoData}"
anything you write in EL expression needs to be loaded previously into zul.So make sure the object is already loaded
You can also use ZK Bind. See example below.
Kai
<?xml version="1.0" encoding="UTF-8"?>
<zk> <zscript>
class A
{
public A(String s, Long v, Boolean is_group) { s_= s; v_= v; is_group_= is_group; }
public String getLabel() { return s_; }
public void setLabel(String s) { s_=s; }
public Boolean isGroup() { return is_group_; }
public Long getValue() { return v_; }
public String getPlaceholder() { return "Please type some text"; }
String s_= null;
Long v_= null;
Boolean is_group_= null;
}
lm.add(new A("Today", 1L, Boolean.TRUE));
lm.add(new A("RE: Bandbox Autocomplete Problem", 2L, Boolean.FALSE));
lm.add(new A("", 3L, Boolean.FALSE));
lm.add(new A("RE: FileUpload", 4L, Boolean.FALSE));
lm.add(new A("", 5L, Boolean.FALSE));
lm.add(new A("Yesterday", 10L, Boolean.TRUE));
lm.add(new A("", 11L, Boolean.FALSE));
lm.add(new A("RE: SelectedItemConverter Question' ite", 12L, Boolean.FALSE));
lm.add(new A("Last week", 100L, Boolean.TRUE));
lm.add(new A("RE: Times_Series Chart help", 101L, Boolean.FALSE));
lm.add(new A("", 102L, Boolean.FALSE));
class VM
{
public ListModel getListModel() { return lm; }
}
]]></zscript>
<window id="win" title="Window ZK6 dynamic template" border="normal" width="600px"
apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('VM')" >
<listbox model="@bind(vm.listModel) @template(each.isGroup() ? 'group_model' : 'item_model')">
<listhead>
<listheader hflex="3" label="Column 1"/>
<listheader hflex="1" label="Column 2"/>
</listhead>
<template name="group_model">
<listgroup open="true" label="@load(each.label)"/>
</template>
<template name="item_model">
<listitem vflex="1">
<listcell>
<textbox hflex="1" placeholder="@init(each.placeholder)" value="@bind(each.label)"/>
</listcell>
<listcell>
<label value="@load(each.value)"/>
</listcell>
</listitem>
</template>
</listbox>
</window>
</zk>
Asked: 2013-07-26 10:03:43 +0800
Seen: 55 times
Last updated: Jul 30 '13