简体   繁体   中英

java primefaces datatable selection counting

I've got a primefaces datatable with some data generated, with multiple selection and pagination and i have to count all the selected rows on each page and i done this but the problem is that i have to count also the number of subpages with selected items on it. So if i check 3 items on page number 1 and 3 items on page number 3 i want an output like: selected: 6 subpages: 2. Is there an easy way to count subpages ? For counting rows i just use a lenght of selected items table. How can i do this ?

You could use a listener in the bean to get current page onselection and kept a tally.

 EX.
 DataTable dataTable = (DataTable) FacesContext.getCurrentInstance().getViewRoot()
            .findComponent("someOformID:someTableId");
    dataTable.getPage()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM