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
close icon

Do event for a selection of checkbox with Syncfusion

Hello 
I want do events with selected elements, I'm using checkbox:



3 Replies

VN Vignesh Natarajan Syncfusion Team March 28, 2019 08:08 AM UTC

Hi Gaudalupe, 
 
Thanks for contacting Syncfusion support. 
 
Query : I want do events with selected elements, I'm using checkbox: 
 
From the given details we suspect that you are using template column to display the checkbox and you want bind the click event for the checkbox. Your achievement can be achieved using the templateRefresh event of Grid. We have achieved your requirement in the below code example. 
 
 
<div> 
        <ej:Grid ID="FlatGrid" runat="server" AllowSorting="True" AllowPaging="True" IsResponsive="true"> 
            <Columns> 
                <ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="True" TextAlign="Right" Width="75" /> 
                <ej:Column Field="CustomerID" HeaderText="Customer ID" Width="80" /> 
                <ej:Column Field="EmployeeID" HeaderText="Employee ID" TextAlign="Right" Width="75" Priority="4" /> 
                <ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="75" Format="{0:C}" Priority="3" /> 
                <ej:Column Field="OrderDate" HeaderText="Order Date" TextAlign="Right" Width="80" Format="{0:MM/dd/yyyy}" Priority="2" /> 
                <ej:Column HeaderText="CheckBox" Template="#columnTemplate" TextAlign="Center" Width="110" /> 
            </Columns> 
            <ClientSideEvents TemplateRefresh="templaterefresh" /> 
        </ej:Grid> 
    </div> 
 
    <script type="text/x-jsrender" id="columnTemplate"> 
        <input type="checkbox" id="check" /> 
    </script> 
 
    <script type="text/javascript"> 
        function templaterefresh(args) { 
            $(args.cell).find("#check").click(function (args) { 
                debugger; 
            }) 
        } 
    </script> 
 
 
Refer our API documentation for your reference 
 
 
If the above provided solution does not meet your requirement please share more details about your requirement. 
 
Regards, 
Vignesh Natarajan. 



GU Guadalupe March 28, 2019 02:31 PM UTC

Oh!
It's great, I can use template but I didn't know the function template refresh.


VN Vignesh Natarajan Syncfusion Team March 29, 2019 05:04 AM UTC

Hi Guadalupe, 

Thanks for the update.  

We are glad to know that you are able to achieve your requirement using TemplateRefresh clientSideEvent.   

Please let us know if you need any further assistance on this. 

Regards, 
Vignesh Natarajan. 





Loader.
Live Chat Icon For mobile
Up arrow icon