0

Can't format date-field in ZUL

asked 2013-09-14 21:11:21 +0800

phil21 gravatar image phil21
30 1

updated 2013-09-16 07:48:06 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

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>
delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0
link publish delete flag offensive edit

Comments

Thanks for your answer. This means, I have to use AnnotationDataBinder to do this formatting and can't stick with the current implementation?

phil21 ( 2013-09-16 21:38:10 +0800 )edit
0

answered 2013-10-07 04:02:32 +0800

benbai gravatar image benbai
2228 6
http://www.zkoss.org

updated 2013-10-07 04:11:01 +0800

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>
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: 2013-09-14 21:11:21 +0800

Seen: 87 times

Last updated: Oct 07 '13

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