Here is my Problem:
- Backing bean is
@SessionScoped - I have a
p:dataTablewith selectionMode set to single and selection#{bean.selectedCar} - first column in the table is a commandLink that updates a dialog :detailDialog, oncomplete shows the dialog and has an actionListener that hast to clear some property in the bean
f:setPropertyListenerhas a value#{item}and target#{bean.selectedCar}
I want that the user is able to click the link and the dialog will display the information for the object on the row, but it works only if a row in the dataTable was selected first. If no row was selected and the user clicks on the commandLink NULL is passed to the bean.selectedCar and the page hangs.
As a workaround I would like at least to be able to preselect the first row in the dataTable and hopefully this will do the trick.
You can re-use your
f:setPropertyListenerin your command link:alternatively (since we are iterating through a dataTable) you can pass the current
#{item}object to your<p:commandLink.../>: