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

can not distinguish row click and row select event in rowSelected event.

hi, i am using treegrid, In rowSelected event, i couldnt tell the difference between the user just click the row or select the row by clicking Selection checkbox.

i added a sample. if you look at the console log, when you click treegrid row, rowSelected event triggered, but there is no way if we can tell the user just select the row or click the select checkbox.

is there any way that we can tell user click the check box or just click the row?



Attachment: SelectionEventTest_af213707.rar

3 Replies

SR Suriyaprasanth Ravikumar Syncfusion Team October 10, 2017 11:16 AM UTC

Hi Ugur, 
 
In TreeGrid “rowSelected” event contains same arguments on when we selecting the row by click on row element and checkbox element. So we can’t differentiate the checkbox click action and row selection action using “rowSelected” event. 
 
In TreeGrid we have “recordClick” event, it will be triggered with current target element before the row/checkbox get selected/updated. Hence we have achieved your requirement by enabling a flag in “recordClick” event to identify weather the checkbox get clicked or not, using this flag we can achieve your requirement. 
Please refer the code snippet below. 
[HTML] 
   $(function() { 
             
            var checkboxFlag = false; 
 
            var gridOptions = { 
                rowSelected: function (args) { 
                    if (checkboxFlag) { 
                        alert(args.data.checkboxState); 
                        checkboxFlag = false; 
                    } 
                }, 
                recordClick: function (args) { 
                    if (args.targetElement.hasClass('e-checkbox')) 
                        checkboxFlag = true; 
                }, 
              //.. 
           }; 
              //.. 
       }); 

Please find the modified sample from below location. 
Please let us know if you need any other assistance.  
Regards,  
Suriyaprasanth R. 



UY Ugur Yilmaz October 10, 2017 12:32 PM UTC

Thanks, that solved my problem.



SR Suriyaprasanth Ravikumar Syncfusion Team October 11, 2017 10:17 AM UTC

Hi Ugur, 
 
Thanks for your update. 
Please let us know if you require any other assistance.  
 
Thanks, 
Suriyaprasanth R.  


Loader.
Up arrow icon