I have a JSF table with check boxes and pagination. I have the following question: I want to select all rows into all table pages and delete them. The simple way is to create a Java hashmap and store the keys. Then Java method will delete them using the keys into the hashmap, but what will happen if the hashmap is more than 1 million? Maybe memory leak? Maybe the solution is to use this simple JavaScript to select all checkboxes:
//Select all checkbox
function selectall(){
$('button').click(function() {
$("[type=checkbox]").prop("checked", true);
})
}
//Unselect all checkbox
function selectall(){
$('button').click(function() {
$("[type=checkbox]").prop("checked", false);
})
}
There are two problems that I face: 1. If I use the JavaScript to select all checkboxes maybe only the checkboxes on the first page will be selected, if I switch on the second page there will not be selected checkboxes. The JavaScript only works for one page. 2. If I select all checkboxes with the JavaScript when I click on the delete button how the Java method would know that every checkbox is selected into the table and delete the rows? How I can solve these problems?