Events when select all or deselect all
When using Checkbox selection <GridSelectionSettings Type="SelectionType.Multiple" /> Is there an event when all the rows are selected or deselected? in Grid and TreeGrid component?
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
RN
Rahul Narayanasamy
Syncfusion Team
February 2, 2021 01:30 PM UTC
Hi Adriana,
Greetings from Syncfusion.
For Grid:
Query: Events when select all or deselect all - While using Checkbox selection, Is there an event when all the rows are selected or deselected? in Grid component?
We have validated your query and you can achieve your requirement by using RowSelected and RowDeselected event of the Grid. The RowSelected event will be triggered while selecting the row using CheckAll and the RowDeselected event will be triggered while deselecting the records. In this event, you can get the corresponding Selected records using GetSelectedRecords() method of the Grid.
Reference:
Please let us know if you have any concerns.
For TreeGrid:
Query#:- While using Checkbox selection, Is there an event when all the rows are selected or deselected? in TreeGrid component?
While Checkbox selection, on performing Select/Deselect All rows RowSelected and RowDeselected event will get trigger. In this event, you can get the SelectedIndexes usingGetSelectedRowIndexes and corresponding Selected records using GetSelectedRecords() method of the TreeGrid.
Refer to the API Link:-
Please get back to us if you need any further assistance on it.
Regards,
Rahul
Marked as answer
AS
Adriana Selena Tito Ilasaca
February 2, 2021 08:09 PM UTC
Hi there,
Yes, it is working but the same event is being triggered when I select another row or other rows. Is there a way to know that the header checkbox(select all deselect all) is the one that is being checked?
Also with AutoCheckHierarchy set to true the RowSelected event is not being triggered is there another one that is being triggered?
Also with AutoCheckHierarchy set to true the RowSelected event is not being triggered is there another one that is being triggered?
RN
Rahul Narayanasamy
Syncfusion Team
February 3, 2021 06:37 AM UTC
Hi Adriana,
Thanks for the update.
Query: Yes, it is working but the same event is being triggered when I select another row or other rows. Is there a way to know that the header checkbox(select all deselect all) is the one that is being checked?
We have validated your query and you want to know that whether the header checkbox is clicked or not while selecting all the rows using CheckAll(HeaderCheckbox). You can check this requirement by using IsHeaderCheckBoxClicked property in RowSelected and RowDeselected event of the Grid.
While selecting all the rows using header checkbox, then this property(IsHeaderCheckBoxClicked) value is true. From this property, you can differentiate whether the header checkbox click or not. Find the below screenshot for your reference.
[When select all rows using Header Checkbox]
|
|
[When selecting a single row]
|
|
Please let us know if you have any concerns.
Regards,
Rahul
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
AS Adriana Selena Tito Ilasaca
- Feb 1, 2021 05:50 PM UTC
- Feb 3, 2021 06:37 AM UTC