I have the primefaces datatable with two buttom (select all and unselect all).
Below code, But I find there is a problem. If in datatables, one of checkbox has been checked, then click select all button, it will have no action. Do you find any problems in below? I just think of for loop for each checkbox, but does not know the code and any other methods? Please help..
Code: Select all
function selectAllUnchanged(){
var chkbox = $(' div.ui-edb-divblock-unchanged tbody.ui-datatable-data td.ui-selection-column .ui-chkbox .ui-chkbox-box');
if(!chkbox.children('span.ui-chkbox-icon').hasClass('ui-icon ui-icon-check')){
chkbox.children('span.ui-chkbox-icon').click();
}
}
function unselectAllUnchanged(){
var chkbox = $(' div.ui-edb-divblock-unchanged tbody.ui-datatable-data td.ui-selection-column .ui-chkbox .ui-chkbox-box');
if(chkbox.children('span.ui-chkbox-icon').hasClass('ui-icon ui-icon-check')){
chkbox.children('span.ui-chkbox-icon').click();
}
}
</script>
<style>
.ui-edb-divblock-unchanged {}
</style>