2
votes

I am developing a web app using JSF, RichFaces, EJB3, Hibernate and Seam.

I have an extended data table and showing a list (say userList) which has multi columns in it. Moreover, because of that this datatable is selectable, I want to keep the selected row indexes even if the sorting is changed by the user.

In other words of what I mean is that when the sorting of columns is changed, the order of row indexes is changed as well. Therefore, I want to invoke an action when the user clicks on sorting on each time. I tried many ways, but could nt find a solution to achieve it yet.

Do you have any idea about which listener or method is being called when sorting is clicked by the user in rich extendeddatatable? I cant understand what the point is in that...

Any help would be appreciated. Many Thanks, Baris

1
I notice this question is almost 2 years old. Did you figure it out, @Bariscan ? If yes, can you post your answer here? - Lisa
I really do not remember so sorry:( but I would take this oppurtunity to suggest primefaces rather than richfaces due to its better convenience, flexibility and ease. - javatar
I'm afraid that doesn't help those of use locked into RichFaces by preexisting company strategy. :) - Lisa

1 Answers

0
votes

A code sample would have been nice, but it sounds like you have a separate list that contains the selected indices, and only update that list on a selection event.

Have you considered having the selection state live with the data object via a bean:

public DataBean {
  private DataModel model;
  private boolean selected;

  //standard getters and setters omitted
}

JSF code:

<h:column>
  <h:selectBooleanCheckbox value="dataBean.selected">
    <a4j:support event="onclick" ajaxsingle="true" />
  </h:selectBooleanCheckbox>
</h:column>

Tie your selection state to the model like this and sorting won't be an issue at all.