How to determine if a checkbox is checked when editing in a Grid

I have a grid that has a Boolean Restock value. I am displaying it as a checkbox. I have another field called actual stock. When the actual stock is entered I need to determine if the Retock value is true or false. Since I am using it as a checkbox how would I determine if it is checked or not?


Here is my code:



1 Reply

JC Joseph Christ Nithin Issack Syncfusion Team September 16, 2021 04:50 PM UTC

Hi Danyelle, 

   Greetings from Syncfusion support. 

  Based on your requirement you want to get the checked state of the checkbox in the change event of the numeric textbox in the edit dialogbox. Your requirement can be achieved by using the `querySelector` option in the form element. The form element can be get using the `args.event.target.closest('form')` where args is the arguments in the change event of the numeric textbox. 

  Please refer the below code example. 


function changed(args) { 
        var formElement = args.event.target.closest('form'); 
        var checkBoxObj = formElement.querySelector('.e-checkbox').ej2_instances[0]; 
        console.log(checkBoxObj.checked); 
    } 


Please find the attached sample and revert for more queries. 

Regards, 
Joseph I 


Loader.
Up arrow icon