Reputation: 6195
p:commandLink action does not fire on my view bean. I tried many things but I did not achieve :(( There should be a simple issue about that. I would be appreciated if you can help me.
<p:dataTable var="message" value="#{messagesView.dataModel}"
id="messageDt" emptyMessage="#{msg['kayitBulunamadi']}"
lazy = "true" paginator="true" rows="10"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="10,15,30" currentPageReportTemplate="{currentPage} / {totalPages}">
<p:column styleClass="min-image">
<f:facet name="header">
<h:outputText value="Durum" />
</f:facet>
<p:commandLink ajax="true" process="@this"
action="#{messagesView.selectedMessages(message)}"
oncomplete="PF('msjDialog').show();">
<!--<p:graphicImage value="#{message.mesajDurumu=='NEW'?'/images/DealerNewMessages.png':'/images/DealerReadMessage.png'}" style="width: 60px; height: 60px;" />-->
<p:graphicImage rendered="#{message.mesajDurumu=='REP'}"
value="/images/email-send.png" style="width: 30px; height: 30px;" />
<p:graphicImage rendered="#{message.mesajDurumu=='NEW'}"
value="/images/DealerNewMessages.png"
style="width: 30px; height: 30px;" />
<p:graphicImage
rendered="#{message.mesajDurumu!='REP' and message.mesajDurumu!='NEW'}"
value="/images/DealerReadMessage.png"
style="width: 30px; height: 30px;" />
</p:commandLink>
</p:column>
Bean Code :
public void selectedMessages(DealerMessages msj) {
SELECTedMessage = msj;
oncekiMesajiAl();
UpdateMessageStatusRead(msj);
}
Upvotes: 0
Views: 824
Reputation: 1535
<p:commandLink>
has to be nested inside a <h:form>
to work properly.
Upvotes: 5
Reputation: 2219
Maybe try this:
<p:commandLink ajax="true" process="@this"
action="#{messagesView.selectedMessages}"
oncomplete="PF('msjDialog').show();">
And get the value as:
... value = "#{messagesView.message} ....
MessagesView Bean code:
public void selectedMessages() {
SELECTedMessage = getMessage();
oncekiMesajiAl();
UpdateMessageStatusRead(SELECTedMessage);
}
What this is doing is that it is setting the variable on the bean through the value of your element. However, you need to make message a field variable inside you bean with a getter and setter; otherwise this won't work.
Upvotes: 1
Reputation: 1571
Did you try to use:
actionListener="#{messagesView.selectedMessages(message)}"
instead of
action="#{messagesView.selectedMessages(message)}"
Upvotes: 1