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

Get checkbox column cell value when button click?

Hi,

I want to know, how to get cell value of a check box column by clicking on a button. Need the value in 'true' or 'false'.

Thank you!

5 Replies

MS Madhu Sudhanan P Syncfusion Team February 22, 2019 07:06 AM UTC

Hi Shamil, 

Thanks for contacting Syncfusion support. 

Before proceeding with your requirement, please check and address the below queries regarding your requirement to provide better solution from our end.   

1.       How checkbox column is rendered in your cell using column template or checkbox selection column [CheckBox Selection]? 
2.       Did you enabled any editing in your grid? If so please share the edit type. 

Regards, 
Madhu Sudhanan P 



NE Neo replied to Madhu Sudhanan P February 22, 2019 08:26 AM UTC

Hi Shamil, 

Thanks for contacting Syncfusion support. 

Before proceeding with your requirement, please check and address the below queries regarding your requirement to provide better solution from our end.   

1.       How checkbox column is rendered in your cell using column template or checkbox selection column [CheckBox Selection]? 
2.       Did you enabled any editing in your grid? If so please share the edit type. 

Regards, 
Madhu Sudhanan P 


1.       How checkbox column is rendered in your cell using column template or checkbox selection column [CheckBox Selection]? 
       
      * Column template using 'ng-template'

2.       Did you enabled any editing in your grid? If so please share the edit type. 

field: 'approval', headerText: 'Approval', textAlign: 'Center', headerTextAlign: 'Center', width: '70'
, template: this.GridCheckBoxTemplate

These are the settings for checkbox column I used. My requirement is get the value of a check box by clicking on separate button.


MS Madhu Sudhanan P Syncfusion Team February 22, 2019 05:00 PM UTC

Hi Shamil, 

Thanks for the update. 

We have prepared the below sample in which the checkbox state is added to the property [items] in component class. And you can use this property to access the checkbox values at the button click. The template used will be as follows. 


export class DefaultComponent implements OnInit { 
    public data: Object[] = []; 
    public item: Object = {}; 
    ngOnInit(): void { 
        this.data = orderDetails; 
    } 
 
    click(): void { 
        console.log(this.item); //Get the checkbox values here... 
    } 
} 

<ng-template #template let-data> 
    <input type="checkbox" ejs-checkbox (input)="item[data.OrderID] = $event.target.checked"/> 
</ng-template> 
 


Regards, 
Madhu Sudhanan P 



NE Neo replied to Madhu Sudhanan P February 25, 2019 04:35 AM UTC

Hi Shamil, 

Thanks for the update. 

We have prepared the below sample in which the checkbox state is added to the property [items] in component class. And you can use this property to access the checkbox values at the button click. The template used will be as follows. 


export class DefaultComponent implements OnInit { 
    public data: Object[] = []; 
    public item: Object = {}; 
    ngOnInit(): void { 
        this.data = orderDetails; 
    } 
 
    click(): void { 
        console.log(this.item); //Get the checkbox values here... 
    } 
} 

<ng-template #template let-data> 
    <input type="checkbox" ejs-checkbox (input)="item[data.OrderID] = $event.target.checked"/> 
</ng-template> 
 


Regards, 
Madhu Sudhanan P 


Thanks a lot. It's working perfectly. Thank you very much again your valuable support. :)


MS Madhu Sudhanan P Syncfusion Team February 25, 2019 04:48 AM UTC

Hi Shamil, 
Thanks for the update. 
Regards, 
Madhu 


Loader.
Up arrow icon