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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Get checkbox column cell value when button click?

Thread ID:

Created:

Updated:

Platform:

Replies:

142838 Feb 21,2019 12:00 PM UTC Feb 25,2019 04:48 AM UTC Angular - EJ 2 5
loading
Tags: Grid
Neo
Asked On February 21, 2019 12:00 PM UTC

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!

Madhu Sudhanan P [Syncfusion]
Replied On 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 


Neo
Replied On 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.

Madhu Sudhanan P [Syncfusion]
Replied On 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 


Neo
Replied On 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. :)

Madhu Sudhanan P [Syncfusion]
Replied On February 25, 2019 04:48 AM UTC

Hi Shamil, 
Thanks for the update. 
Regards, 
Madhu 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon