Issue with JSF Primefaces datatable update - need your advic

UI Components for JSF
Post Reply
suman kilari
Posts: 2
Joined: 06 Jan 2012, 15:15

09 Jan 2012, 08:26

I am facing issue with calling of javascript function in the JSF Primefaces page when i edit the row in the datatable.

I am using primeface verison 2.0

Issue is when we click on the datatable rowedit after editing the data , request will go to the bean and it will try to update it in the DB ( stored procedure is called).
If procedure returns the code as 2, we have to display javascript function with message "This update will delete/change activity period of existing models Continue?" with Yes and No buttons.

I am unable to generate this javascript function with Yes or No buttons (call the javascript from the datatable onroweditlistener).

Could you please tell me how to achieve this functionality?

below is the code

<p:dataTable id="values" var="items"
value="#{maintGSPForecastModelBean.searchResults}"
styleClass="pageLabel"
selectionMode="single" selection="#{maintGSPForecastModelBean.selectedRow}"
rowEditListener="#{maintGSPForecastModelBean.rowEdit}" onRowEditUpdate="confirmation.show();">

<p:column headerText="GSP Group">
<h:outputText value="#{items.gspGroup}" />
</p:column>

<p:column headerText="GTime">
<h:outputText value="#{items.gTime}" />
</p:column>
<p:column headerText="Type">
<h:outputText value="#{items.forecastType}" />
</p:column>

<p:column headerText="Start Date" >
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{items.startDate}" />
</f:facet>
<f:facet name="input">
<p:inputMask id="stDate" mask="99999999"
value="#{items.startDate}" required="false">
</p:inputMask>
</f:facet>
</p:cellEditor>
</p:column>


<p:column headerText="End Date" >
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{items.endDate}" />
</f:facet>
<f:facet name="input">
<p:inputMask id="edDate" mask="99999999"
value="#{items.endDate}" required="false">
</p:inputMask>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Last Updated">
<h:outputText value="#{items.tStamp}" />
</p:column>
<p:column headerText="Options">
<p:rowEditor/>
<p:commandLink
action="#{maintGSPForecastModelBean.deleteRow}"
value=" " styleClass="ui-icon ui-icon-trash"
update="gspForecastModel:values" ajax="true" immediate="true">
<f:setPropertyActionListener
target="#{maintGSPForecastModelBean.selectedRow}"
value="#{items}" />
</p:commandLink>
</p:column>
</p:dataTable>
<p:confirmDialog message="Are you sure?"
width="500"
header="Confirm" severity="alert" widgetVar="confirmation" >
</p:confirmDialog>

Please advice me on this....

Thanks and Regards,
Suman

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 26 guests