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

"Select all" checkbox doesn't emit event checkboxChange

Thread ID:

Created:

Updated:

Platform:

Replies:

145979 Jul 16,2019 02:14 PM UTC Jul 19,2019 01:34 PM UTC Angular - EJ 2 6
loading
Tags: TreeGrid
Damir Gabeljic
Asked On July 16, 2019 02:14 PM UTC

Hi, I am currently evaluating and testing your sample code of Checkbox column.

You can find modified sample here: https://stackblitz.com/edit/angular-ybvgpa 

Clicking on checkbox in data rows does emit checkboxChange event, but clicking on checkbox in header row (aka Select all) doesn't.

What's the proper way to obtain checked rows after clicking the "select all" checkbox?

Thanks in advance
 Damir

Damir Gabeljic
Replied On July 17, 2019 06:34 AM UTC

Moreover, is it possible to enable autoCheckHierarchy property in your Checkbox Selection sample?
Event after setting autoCheckHierarchy to true, clicking on parent checkbox doesn't change child's checkbox state or vice versa.

To be noticed, in this sample, clicking on checkbox in header row (aka Select all) does emit checkboxChange event.

Thanks in advance
 Damir

Manivannan Padmanaban [Syncfusion]
Replied On July 17, 2019 07:16 AM UTC

Hi Damir, 

Greetings from Syncfusion Support. 

Checkbox selection 

Checkbox Selection provides an option to select multiple TreeGrid records with help of checkbox in each row. To render checkbox in each treegrid row, you need to use checkbox column with type as CheckBoxusing column type property. In that using getSelectedRows and getSelectedRecords method, we can get the selectedrows and selected records respectively. Refer the below demo link for checkbox selection and help documentation links, 


CheckboxColumn Selection 

To render checkboxes in existing column, you need to set [columns.showCheckbox] property as true. 
It is also possible to select the rows hierarchically using checkboxes in TreeGrid by enabling [autoCheckHierarchy] property. When we check on any parent record checkbox then the child record checkboxes will get checked. 

In checkbox column selection, checkbox change event will trigger only for the data rows checkbox which is the default behavior of TreeGrid. Using getCheckedRecords method, we can get the checked row data. Refer the below sample link, 

autoCheckHierarchy property is only for checkbox column we can’t use it for checkbox selection

Kindly get back to us, if you need further assistance. We will be happy to assist you. 

Regards, 
Manivannan Padmanaban. 


Damir Gabeljic
Replied On July 17, 2019 10:36 AM UTC

CheckboxColumn Selection 

In checkbox column selection, checkbox change event will trigger only for the data rows checkbox which is the default behavior of TreeGrid. Using getCheckedRecords method, we can get the checked row data. Refer the below sample link, 

Hi 
Manivannan

thanks for clarification about CheckboxColumn Selection.

Now, the new problem is that inside checkboxchange event, getCheckedRecords() method returns incorrect data. 
Instead of returning currently checked rows, it returns rows that were checked before event.


The purpose is to sum some properties of the checked rows in real time, as soon as the checkboxes are clicked.
Delayed approach by clicking outside button is not an option.

Thanks in advance.

Manivannan Padmanaban [Syncfusion]
Replied On July 18, 2019 08:38 AM UTC

Hi Damir, 

Thanks for the update. 

Checkbox column – is used only for check the data not for selection

In checkbox column,  we have updated the checked rowData after the checkboxChange event. But from the shared code example, we could see that you have try to get the checked records in the checkbox change event itself. Due to this previously selected data is shown in the getCheckedRecords method

If you want to get the checked records at the time of checkboxChange event, then we suggest you to get the checked records from the checkboxChange event parameter args. Refer the below screenshot, 

 
Query: Clicking on checkbox in data rows does emit checkboxChange event, but clicking on checkbox in header row (aka Select all) doesn't  

We have validated the defect you have initiated with us. Thank you for the taking the time to report the issue and helping us improve our product. At Syncfusion we are committed to fixing all the validated defect (subject to technological feasibility and Product Development Life Cycle) and including its fix in our subsequent release. So fix for the issue will be included in our upcoming patch release which is expected to be rolled out in 29th July 2019. 

You can track the current status of your request, by below feedback link.    

Note: To view the above feedback, kindly login into your account.  
    
Till then we appreciate your patience.   

Regards, 
Manivannan Padmanaban.  
  
 


Damir Gabeljic
Replied On July 18, 2019 10:27 AM UTC

If you want to get the checked records at the time of checkboxChange event, then we suggest you to get the checked records from the checkboxChange event parameter args

Hi Manivannan,

thanks for further clarification.

The problem is still present: even if I get the checked records from the checkboxChange event parameter args, their checkboxState is not actual, but it' s previous one.

As I can see, you trigger this event with current (previous) row data, check if it is cancelled, and only then proceed with modifications on the row (and it's relatives (parent and/or child)) respecting autoCheckHierarchy property of treegrid).

So, as checboxChange event is trigerred before the actual modifications happen, it's not possible to get current checkboxStates of the row and it's relatives.

One solution would be to have two events: checkboxChanging (with previous data and cancel property) and checkboxChanged (with new data).

Sorry if my suggestions are out of scope of this conversation.

Thanks in advance
 Damir

Manivannan Padmanaban [Syncfusion]
Replied On July 19, 2019 01:34 PM UTC

Hi Damir, 

Thanks for the update. 

Query 1: So, as checboxChange event is trigerred before the actual modifications happen, it's not possible to get current checkboxStates of the row and it's relatives. 
 
As you said, currently the checkboxChange event is triggered before the check state change.  We consider this as bug  and it will be logged in the below feedback link. So both fix will be included in our upcoming patch release which is expected to be rolled out in 29th July 2019.  

You can track the current status of your request, by below feedback link.     

Note: To view the above feedback, kindly login into your account.   
     
Till then we appreciate your patience.    

Regards,  
Manivannan Padmanaban.   




Regards, 
Manivannan Padmanaban. 


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