We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Question: intercept on click action of the top-checkbox in the checkbox-column (Grid) ?

Hi,
sorry if this question has been asked before.
is it possible to intercept on click action of the top checkbox in the checkbox-column?
or see picture below.
i am aware of the checkboxchange event (https://ej2.syncfusion.com/documentation/api/grid/#checkboxchange)
but it doesn't seem to be realy helpful since it triggers on all checkboxes in checkbox column.
thanks in advance
viktor


3 Replies

MS Manivel Sellamuthu Syncfusion Team August 28, 2019 07:19 AM UTC

Hi Viktor, 

Thanks for contacting us. 

Yes. You can distinguish the header and row checkboxes based on the checkBoxChange event target. Please find the below code example and sample for more information. 

App.component.html 
   <ejs-grid #grid [dataSource]='data' allowPaging='true' [enableHover]="false"  (checkBoxChange)="checkBoxChange($event)" [allowSelection]="true" [selectionSettings]="selectOptions" [editSettings]='editSettings' [toolbar]='toolbar'> 
. . . 
    </ejs-grid> 
App.component.ts 
export class AppComponent { 
. . . 
    public checkBoxChange (args) { 
      if (args.target.classList.contains('e-checkselectall')) { 
        console.log ('Header checkBox is clicked'); 
      } 
      else { 
        console.log ('Row checkbox is cliked'); 
        // here you can get the row information for the checkBox clicked row 
        console.log(this.grid.getRowInfo(args.target)); 
      } 
    } 


Please get back to us, if you need further assistance. 

Regards, 
Manivel 



VI Viktor August 28, 2019 09:27 AM UTC

Thank you Manivel for your quick response !
it works perfectly.
regards
Viktor


MS Manivel Sellamuthu Syncfusion Team August 28, 2019 09:31 AM UTC

Hi Victor, 

We are happy to hear that your requirement has been achieved. 

Please get back to us, if you need further assistance. 
 
Regards, 
Manivel 


Loader.
Live Chat Icon For mobile
Up arrow icon