This is a migrated thread and some comments may be shown as answers.

Client-side OnRowSelecting is fired when deselecting

1 Answer 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adam
Top achievements
Rank 1
Adam asked on 14 Oct 2008, 05:33 PM
I've used some code that was provided by telerik to make it so users can only select a rows using the GridClientSelectColumn. Here is the javascript event.

function CancelNonInput(sender, args)    
            {    
                alert(1); 
                var e = args.get_domEvent();   
                //IE - srcElement, Others - target   
                var targetElement = e.srcElement || e.target;   
                             
                //is the clicked element an input checkbox? <input type="checkbox"...>   
                if(targetElement.tagName.toLowerCase() != "input" &&    
                    (!targetElement.type || targetElement.type.toLowerCase() != "checkbox"))  
                {                       
                    //cancel the event   
                    args.set_cancel(true);   
                }   
            }  

I'm using this on the OnRowSelecting and OnRowDeselecting with this event and it has worked in the past. However, for some reason, when I use it now, it works fine when checking the checkbox, but when I deselect the box, it clears the box and reselects it again, firing off the CancelNonInput event twice. Why is it all of a sudden reselecting the column after deselecting the column.

Thanks,

Adam

1 Answer, 1 is accepted

Sort by
0
Adam
Top achievements
Rank 1
answered on 15 Oct 2008, 05:23 PM
I found out the problem. I didn't have the AllowMultiRowSelection enabled.
Tags
Grid
Asked by
Adam
Top achievements
Rank 1
Answers by
Adam
Top achievements
Rank 1
Share this question
or