I am having a ajax listener who should redirect to item view page.
However since I am using generic type as model I would like to specify additionally in my common datatable controller what is the view with a second parameter.
Unfortunately one can choose between two listener approaches one using event parameter which helps identifying the object and the second one gives you the opportunity to send free param but lacks the event.
template:
<p:dataTable value="#{aObj.objList}" var="item" ... selectionMode="single">
<p:ajax event="rowSelect" listener="#{aObj.viewItem}" />
<p:ajax event="rowSelect" listener="#{aObj.viewItem('myItemView?_id=')}" />
...
</p:dataTable>
controller:
public void viewItem(SelectEvent event) {
// ...
}
public void viewItem(String viewUrl) {
// ...
}
I can add additional properties to the bean but since it is generic and providing model items doesn't feel right to pollute it.
Is there any workaround?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…