Hi ,
I am trying to make the cell clickable on the data table and on click event it should navigate to some other page . I have made a command link on the column and i call a backing bean method which has logic to navigate .
Code snippet is :
<p:column style = "text-align:center" sortBy="#{delInfo.repCode}" filterBy = "#{delInfo.repCode}" filterMatchMode="contains" filterEvent = "enter">
<f:facet name="header">
<h:outputText value="#{msg.repcode}"/>
</f:facet>
<p:commandLink id="test" ajax = "false"
value = "#{delInfo.repCode}"
actionListener="#{delinfo.cellClicked}"/>
</p:column>
Bean method is :
public String cellClicked(){
System.out.println("in cell clicked");
return "AccountSummaryadv?faces-redirect=true";
}
The method get called but i am unable to navigate. It refeshes the same page .
Can someone help to know what i am doing wrong or what is the approach to achieve this .
Using PF 3.0M3.
Thanks in advance .
Data Table cell selection and navigation
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
Take a look at PrimeFaces Showcase page at URL below. refer to the code of the View button (hover mouse over the buttons on each row to see the name of each button) on each row. Refer to the View button code. That should help your scenario. Seems as though you need a commandLink instead of a commandButton, but commandLink and commandButton are very similar (just different look and feel).
http://www.primefaces.org/showcase-labs ... Column.jsf
http://www.primefaces.org/showcase-labs ... Column.jsf
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
i had already seen that example . In the example there is separate column on which the command button exist . But in my scenario i have to make the links on the value and make them clickable . Also i have multiple columns on datatable which can be links. So i cannot have as many command buttons on a different column. any suggestions on this
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
Your question is about fundamental JSF navigation. Click URL below and see BalusC's answers and responses; he talks about JSF navigation that is similar to what you're trying to do.
http://stackoverflow.com/questions/5406 ... -with-ajax
http://stackoverflow.com/questions/5406 ... -with-ajax
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
Solved it .
The code changed is :
<p:column style = "text-align:center" sortBy="#{delInfo.repCode}" filterBy = "#{delInfo.repCode}" filterMatchMode="contains" filterEvent = "enter">
<f:facet name="header">
<h:outputText value="#{msg.repcode}"/>
</f:facet>
<p:commandLink id="test" ajax = "false"
value = "#{delInfo.repCode}"
action="#{delinfo.cellClicked(delInfo.repCode)}"/>
</p:column>
added ajax = "false" and instead of actionListener added action .
Thanks
The code changed is :
<p:column style = "text-align:center" sortBy="#{delInfo.repCode}" filterBy = "#{delInfo.repCode}" filterMatchMode="contains" filterEvent = "enter">
<f:facet name="header">
<h:outputText value="#{msg.repcode}"/>
</f:facet>
<p:commandLink id="test" ajax = "false"
value = "#{delInfo.repCode}"
action="#{delinfo.cellClicked(delInfo.repCode)}"/>
</p:column>
added ajax = "false" and instead of actionListener added action .
Thanks
-
- Information
-
Who is online
Users browsing this forum: No registered users and 56 guests