| Author |
Datatable not updating when clicking on commandlink
|
Andrew Dambrosio
Greenhorn
Joined: Jul 04, 2011
Posts: 3
|
|
I am using JSF1.2 and Richfaces 3.3 and have a datatable with a column that contains an up arrow and another column that has a down arrow. These allow you to move the row up and down. However, when I click on them, the moveUp method in the bean is triggered and the order is updated, but I don't see this in my browser. When I trigger it again, I can tell (with printlns) that the order is reset to what was originally retrieved from the database.
Below is an extract of my JSP and bean. Please help
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14491
|
|
A commandLink will never execute if any data on the form fails valiadation. That's the most common problem people have - they didn't put a general "errors" tag on the page, forgot to set a field value, and the message was lost.
However, in this case, I think it's most likely that your actionListener is invalid. You provided a "throws Exception" clause to the method signature and I think that disqualifies it from being seen by the EL processor. If you need to throw an exception, wrap it in a JSFException. They're unchecked, so they don't need to be declared in the signature.
In any event, there's no benefit in using an actionListener here. You should use a simple "action" instead.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Andrew Dambrosio
Greenhorn
Joined: Jul 04, 2011
Posts: 3
|
|
|
I just tried what you said and it made no difference. The datatable is not rerendered properly. At the end of the moveUp method, the order is correct. But it seems like between the end of that method and the re-render, the changes are lost. I added a <h:messages> tag and there is no error.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14491
|
|
I'm a little confused here. You're showing code for binding a dataTable, although for this particular function, there's no need for binding.
But you're not showing how you defined the DataModel object that wraps your data for the table, and that's the critical part.
|
 |
 |
|
|
subject: Datatable not updating when clicking on commandlink
|
|
|