Events when SelectionType is set to multiple using checkboxes

Working with selection and ShowCheckbox and AutoCheckHierarchy, folowing the Documentation When you select the checkbox of the header, RowSelected or rowDeselected events are not being triggered is there another event that is being triggered? The events (RowSelected and RowDeselected) are only triggered when you select a parent checkbox.
I saw the 
CheckboxChange is triggered when I select the headercheck (selectAll) but also when I click other checks so is not exclusive for the headerCheck.
I do not know if there is an event triggered when I select the Header Check when using 
ShowCheckbox and AutoCheckHierarchy,


3 Replies 1 reply marked as answer

PK Padmavathy Kamalanathan Syncfusion Team February 4, 2021 01:33 PM UTC

Hi Adriana, 
 
Thanks for contacting Syncfusion Forums. 
 
Query: I saw the CheckboxChange is triggered when I select the headercheck (selectAll) but also when I click other checks so is not exclusive for the headerCheck. 
I do not know if there is an event triggered when I select the Header Check when using ShowCheckbox and AutoCheckHierarchy 
 
As you have mentioned, RowSelected event will be triggered when you check the checkboxes present in rows of Tree Grid. When you check header checkbox, only “CheckboxChange” change event will be triggered. We can find whether header checkbox is selected or not from the “SelectedRowIndex” property which is present in the arguments of “CheckboxChange” event. If the “args.SelectedRowIndex” is -1, that means header checkbox has been checked. If we select checkboxes present in rows, the SelectedRowIndex will be from 0 up to the number of records present. 
 
Please check the below code snippet, 
 
 
        public void change(CheckBoxChangeEventArgs<TreeData> args) 
        { 
if (args.SelectedRowIndex == -1) // checking if header checkbox has been selected 
            { 
                //perform your action 
            } 
        } 
 
Please check the below Screenshot, 
 
 
Kindly get back to us for further assistance. 
 
Regards, 
Padmavathy Kamalanathan 


Marked as answer

GM gamaliel mateos September 21, 2023 03:22 PM UTC

hola quisiera saber por favor si es posible utilizar los eventos:

-Caja

-FilaSeleccionada

-ContextMenuItemClicked

y al mismo tiempo utilizar un DataSource de la siguiente manera: 

  <SfGrid @ref="@Grid_Gastos" DataSource="@GastosDs.Where(g => g.IIDSucursal == sucursal.IIDSucursal && g.SStatus == "Pendiente")"


ya que al tratar de seleccionar una fila el checkbox no se queda marcado pero si ocurre el evento.

mi codigo: 

<SfGrid @ref="@Grid_Gastos" DataSource="@GastosDs.Where(g => g.IIDSucursal == sucursal.IIDSucursal && g.SStatus == "Pendiente")"

                            AlturaFila="26" Altura="200"

                            AllowSorting="true" AllowFiltering="true" AllowPaging="false" AllowSelection="true"

                            ContextMenuItems="@(new List<ContextMenuItemModel>() {new ContextMenuItemModel {Text = "Autorizar Gastos", Target = ".e-content", Id="Autorizar"}})">

                        <GridSelectionSettings Type="Syncfusion.Blazor.Grids.SelectionType.Multiple"></GridSelectionSettings>

                        <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Excel"></GridFilterSettings>

                        <GridEvents ContextMenuItemClicked="OnContextMenuClick" RowSelecting="FilaSeleccionada" TValue="AutorizacionesModels"></GridEvents>

                        <GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Dialog"></GridEditSettings>

                        <Columnas de cuadrícula>

                                <GridColumn Type="ColumnType.CheckBox" IsFrozen="true" Ancho="60"></GridColumn>





PS Prathap Senthil Syncfusion Team September 26, 2023 02:21 AM UTC

Hi Gamaliel,

Before proceeding with the reporting problem, we require some additional clarification from your end. Please share the below details to proceed further at our end.
               

  • Are you encountering an issue where the checkbox does not checked when selecting it.
  • Or could you please provide more detailed information about the exact requirements?
  • It would be helpful if you could provide a video demonstration of the issue.
  • Could you please share an issue-reproducible sample .

Above-requested details will be very helpful in validating the reported query at our end and providing a solution as early as possible.


Regards,
Prathap S


Loader.
Up arrow icon