-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I am trying to format a date-field in a listbox, but can't figure out how I should do that in the ZUL file. The filed value="${each.created}"
is of type java.util.Date
, so I would like to use another format, as the default one. Do I need to move the list-code to Java, or is there another possibility of doing the formatting in ZUL?
Thanks,
Phil
Here is the current implementation of the listbox:
<listbox id="newsListbox" vflex="1">
<template name="model">
<listitem value="${each}">
<listcell>
<label value="${each.created}" />
</listcell>
<listcell>
<label value="${each.lastChanged}" />
</listcell>
<listcell>
<label value="${each.title}" />
</listcell>
</listitem>
</template>
</listbox>
You can also try to display it with datebox and custom style:
<zk xmlns:w="client">
<style>
.datebox-display-only {
padding: 0 !important;
background: transparent !important;
opacity: 1 !important;
}
.datebox-display-only input {
border: 0 !important;
padding: 0 !important;
width: 170px;
background: transparent !important;
color: #000 !important;
}
</style>
<zscript><![CDATA[
Date d = new Date();
]]></zscript>
<listbox>
<listitem>
<listcell>
<!-- inplace and disabled -->
<!-- set value and format -->
<!-- customize style -->
<datebox inplace="true" disabled="true"
value="${d}" format="yyyy - MM - dd, hh:mm:ss.SSS"
sclass="datebox-display-only" />
</listcell>
</listitem>
<listitem>
<listcell>
<datebox inplace="true" disabled="true"
value="${d}" format="yyyy - MM - dd, hh:mm:ss.SSS"
sclass="datebox-display-only" />
</listcell>
</listitem>
</listbox>
</zk>
Asked: 2013-09-14 21:11:21 +0800
Seen: 87 times
Last updated: Oct 07 '13