jquery datatable checkbox select all

UI Components for JSF
Post Reply
rchiu5hk
Posts: 32
Joined: 29 Jun 2015, 03:50

11 Oct 2016, 16:12

Dear all,

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>

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests