Surya
Surya

Reputation: 426

p:cellEditor converts date to to date/time

I am using p:cellEditor, but when I am editing my date field it changes with selected date with time as 00:00:00:0

I want only date to be displayed , I dont know how to remove time . '

<p:dataTable  id="foodTableId" var="v" value="#{dashboardBean.myFoodList}" paginator="true"rows="#{msg['dashboard.product.mapping.datatable.rows']}" editable="true" >

                                                            <p:ajax event="rowEdit" listener="#{dashboardBean.onEdit}" />
                                                            <p:ajax event="rowEditCancel" listener="#{dashboardBean.onCancel}" />



                                <p:column sortBy="#{v.promoDate}"  headerText="Action Date">
                                                                <p:cellEditor>
                                                                    <f:facet name="output">
                                                                        <h:outputText
                                                                            value="#{v.promoDate}" />
                                                                    </f:facet>
                                                                    <f:facet name="input">
                                                                        <p:calendar value="#{v.promoDate}" />
                                                                    </f:facet>
                                                                </p:cellEditor>
                                                            </p:column>

                                                            <p:column headerText="#{msg['product.label.edit']}"
                                                                style="width:20%">
                                                                <p:rowEditor />
                                                            </p:column>


                                                        </p:dataTable>

Upvotes: 0

Views: 800

Answers (1)

Mr.J4mes
Mr.J4mes

Reputation: 9266

You need to add the attribute pattern. Something like this would do:

<p:calendar pattern="MMM dd, yyyy" value="#{v.promoDate}" />

It seems you've not touched the documentation :). It won't bite :P

Upvotes: 2

Related Questions