Hello,
I know this stuff will be documented in the official doc when version 3 is ready, but I would love to check out the cool stuff now
So my question is: What's the name of the Ajax-Event when something in a data table changed because of a p:cellEditor usage?
(I thought this could be done some times before the whole ajax stuff changes with something like "onRowEdit")
Regards
Alesandro
<p:cellEditor> Ajax Event
It seems to be named "rowEdit" so I thought of this implementation:
Any ideas why this is resolved to null?
Code: Select all
<p:dataTable>
<p:ajax event="rowEdit" listener="#{controllerBeanPM.editEvent(event)}" />
</p:dataTable>
Code: Select all
public void editEvent(RowEditEvent event) {
// method fired
// event == null
}
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Code: Select all
<p:ajax event="rowEdit" listener="#{controllerBeanPM.editEvent}" />
Oh man - I'm really sorry for the last post, because simply restarting Glassfish solved it (don't ask me why).
Anyway this solution is now working:
Anyway this solution is now working:
Code: Select all
<p:dataTable>
<p:ajax event="rowEdit" listener="#{controllerBeanPM.editEvent}" />
</p:dataTable>
Code: Select all
public void editEvent(RowEditEvent event) {
// do stuff
}
Hello.. im using the Primefaces 3.0.3M snapshot.. trying to make this component work with EJB, i followed the code posted by Optimus Prime
and the backing bean method that updates using the EJB is being called.. but i'm having a problem...
I need to get the Current Item from the datatable i'm editing.. but i'm getting null pointer exception.. where or how should i place
the setProperyActionListener to update the current item... as i do in other actions when using command Buttons..
tried placing it at the Output, the RowEditor and ajax Event.. but not working.. think anyone could help with an example? thanks
<f:setPropertyActionListener value="#{user}" target="#{lazyBean.selectedPersona}" />
and the backing bean method that updates using the EJB is being called.. but i'm having a problem...
I need to get the Current Item from the datatable i'm editing.. but i'm getting null pointer exception.. where or how should i place
the setProperyActionListener to update the current item... as i do in other actions when using command Buttons..
tried placing it at the Output, the RowEditor and ajax Event.. but not working.. think anyone could help with an example? thanks
<f:setPropertyActionListener value="#{user}" target="#{lazyBean.selectedPersona}" />
Solved my problem . but if you can add a better Solution i would gladly appreciate it...
This is how i managed to solved it..
Code for Creating the DataTable and setting the Ajax event to call the save/update method when rowEdit method called..
<p:dataTable var="user" value="#{lazyBean.listarConductores()}" id="tbl"
rows="10" paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="10,20,30,50"
rowKey="#{user.idlicencia}"
page=""
>
<p:ajax event="rowEdit" listener="#{lazyBean.save()}" />
and this is the code.. i used to update the current or selected item in the table... i used the valueChangeListener in the InputText component to update the current
item value... i tried using the usual SelectedItem... but couldn't use the default setProperty when using ValueChangeListener, so i had to develop a new method
that receives a parameter(curren item) and name does not start to set.....
<p:column headerText="Telefono" >
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{user.telefono}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{user.telefono}" style="width:100%" valueChangeListener="#{lazyBean.updateUser(user)}" />
</f:facet>
</p:cellEditor>
</p:column>
I know there must be a better solution.. but this worked right now.. any improvements are welcome...
This is how i managed to solved it..
Code for Creating the DataTable and setting the Ajax event to call the save/update method when rowEdit method called..
<p:dataTable var="user" value="#{lazyBean.listarConductores()}" id="tbl"
rows="10" paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="10,20,30,50"
rowKey="#{user.idlicencia}"
page=""
>
<p:ajax event="rowEdit" listener="#{lazyBean.save()}" />
and this is the code.. i used to update the current or selected item in the table... i used the valueChangeListener in the InputText component to update the current
item value... i tried using the usual SelectedItem... but couldn't use the default setProperty when using ValueChangeListener, so i had to develop a new method
that receives a parameter(curren item) and name does not start to set.....
<p:column headerText="Telefono" >
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{user.telefono}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{user.telefono}" style="width:100%" valueChangeListener="#{lazyBean.updateUser(user)}" />
</f:facet>
</p:cellEditor>
</p:column>
I know there must be a better solution.. but this worked right now.. any improvements are welcome...
-
- Information
-
Who is online
Users browsing this forum: No registered users and 27 guests