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

Disable horizontal auto scroll

Hi,

     I have a grid control with lots of columns. If I scroll horizontally to see the columns that are out of view on the right and then double click to edit a cell, the grid auto scrolls to the first editable cell in the row. 

Is there a way to prevent this behaviour and to set focus to the clicked cell (or nearest editable cell) instead ?

Thanks for your help.

Gary

3 Replies

PS Pavithra Subramaniyam Syncfusion Team February 20, 2019 10:55 AM UTC

Hi Gary, 
 
We have analyzed your query and we suggest you to use JavaScript dblClick event to achieve your requirement. In the event, we can get the clicked td element and we add the focus to that cell by its column index. Please find the below sample for your reference.  
   
[index.cshtml]  
   
  var grid = document.getElementById("Grid");   
    grid.addEventListener("dblclick", cellSelect);  
                
    function cellSelect(event) {   
        var colIndex = event.target.getAttribute("aria-colindex");   
        event.currentTarget.querySelectorAll(".e-field")[colIndex].focus();   
    }   
 
 
   
Please get back to us for further assistance. 
 
Regards, 
Pavithra S. 



GA Gary February 20, 2019 11:45 AM UTC

Thanks for your help. It works great (with a slight tweak to subtract the number of frozen columns from colindex).

Gary




PS Pavithra Subramaniyam Syncfusion Team February 20, 2019 12:03 PM UTC

Hi Gary, 
 
Thanks for your update. 

We are happy to hear that the provided information helps you. 

Please contact us if you need any further assistance. As always, we will be happy to assist you.  
 
Regards, 
Pavithra S. 


Loader.
Live Chat Icon For mobile
Up arrow icon