0

I am using ace datatable with pagination. Now, in a page after selecting some rows, when I go to another page and come back, the selection disappears. Rows are not selected anymore.

Here is the code:

<ace:dataTable var="device" value="#{reportBean.searchTableList}"
                        id="MeterTable" rows="10" paginator="true"
                        paginatorPosition="bottom" page="1" selectionMode="multiple"
                        stateMap="#{reportBean.rowStateMap}" pageCount="4" 
                        rowStyleClass="oddRow1,evenRow1">


                        <ace:column id="column3" headerText="Meter Name"
                            sortBy="#{device.device_name}" filterBy="#{device.device_name}"
                            selected="true"
                            filterMatchMode="contains" styleClass="dataTableHeader">
                            <ice:outputText value=" #{device.device_name}" />
                        </ace:column>
</ace:dataTable>
user746458
  • 369
  • 2
  • 13
  • 26

1 Answers1

2

Seems like your reportBean is RequestScoped. this means when you browse to the page with the table the reportBean is loaded and when you do a selection the selection values are stored in reportBean.rowStateMap. when browsing to another page the reportBean and the selection information get deleted because it is not the same request (Request Scoped!). when you browse to the table page again, a new reportBean is created which doesn't has any information about the selection

You can try changing your reportBean to SessionScoped but that has other impacts which you should consider.

Echilon
  • 10,064
  • 33
  • 131
  • 217
unwichtich
  • 36
  • 3