This content has been marked as final.
Show 3 replies
-
1. Re: Why rich:extendedDataTable state depends on where a comm
crucifix May 26, 2009 3:45 PM (in response to crucifix)Apologies for the long title. Original title was:
Why rich:extendedDataTable state depends on where a commandButton was clicked.
Thanks! -
2. Re: Why rich:extendedDataTable state depends on where a comm
ilya_shaikovsky May 27, 2009 5:16 AM (in response to crucifix)show the code please.
-
3. Re: Why rich:extendedDataTable state depends on where a comm
crucifix May 27, 2009 1:46 PM (in response to crucifix)Here's the code, thanks! Using Richfaces 3.3.0.GA. Please let me know if I can provide anything else. Again, there's something special about this button being inside a column that causes the table to have a valid rowIndex, I'm just not sure what this process is.
JSF Page:<rich:extendedDataTable id="searchResults" value="#{searchBean.items}" var="item" binding="#{searchBean.table}"> ... <rich:column id="colSubmit" width="100" label="Submit"> <a4j:commandButton value="Submit" id="submitButton1" action="#{searchBean.logDebugInfo}" /> </rich:column> </rich:extendedDataTable> <br clear="all" /> <a4j:commandButton value="Submit" id="submitButton2" action="#{searchBean.logDebugInfo}" />
faces-config.xml:<faces-config> ... <managed-bean> <managed-bean-name>searchBean</managed-bean-name> <managed-bean-class>mypackage.webapp.pages.SearchBean</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> ... </faces-config>
Java Code:public void logDebugInfo() { table.setRowKey(table.getRowIndex()); SearchItem selectedItem = (SearchItem)table.getRowData(); logger.debug(String.format("Selected Item: %s", selectedItem.toString())); }
The call to table.getRowIndex() always succeeds when invoked through submitButton1. However, the call always throws javax.faces.model.NoRowAvailableException when submitButton2 is invoked, whether or not a row is selected. I've also tried set the managed bean to session scope just to see what would happen, but the results are the same.
Looking forward to learning how to diagnose these things, thanks!