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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to select the text automatically when the user starts editing a cell in the grid

Thread ID:

Created:

Updated:

Platform:

Replies:

141544 Dec 17,2018 01:40 PM UTC Dec 18,2018 11:12 AM UTC ASP.NET MVC - EJ 2 3
loading
Tags: Grid
Guia
Asked On December 17, 2018 01:40 PM UTC

Hi there!

i'm using a grid and i need that the text get selected automatically when user want edit the cell (when the cell is modified to edit mode.).
i've tried to use BeginEdit method, but without success, cause appear that the text is selected, but some event after my intervenção unselect the text.





Thank so mutch!


Guilherme



Mohammed Farook J [Syncfusion]
Replied On December 18, 2018 05:48 AM UTC

Hi Guia, 
 
Thanks for contacting Syncfusion support. 
 
Query : i need that the text get selected automatically when user want edit the cell (when the cell is modified to edit mode.) 
 
We have analyzed your query and we have found that the event name is given incorrectly in the grid. So we suggest to use the cellEdit event of the grid and using select() method in the setTimeout method you can select the input text. Please refer to the below sample and documentation for your reference, 
 
Code Example: 
 
[.cshtml] 
... 
    @Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.datasource).Columns(col => 
{... 
}).AllowPaging().CellEdit("cellEdit").EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Batch); })...}).Render() 
 
 
<script> 
    function cellEdit(args){ 
        setTimeout(function selectText() { 
            this.cell.querySelector('input').select(); 
        }.bind(args), 0); 
    } 
</script> 
... 
 
 
 
Please get back to us for further assistance. 
 
 
Regards, 
J Mohammed Farook 


Guia
Replied On December 18, 2018 11:03 AM UTC

Hi!!

The code worked perfectly! Thank you very much for your attention.

Regards
Guilherme

Mohammed Farook J [Syncfusion]
Replied On December 18, 2018 11:12 AM UTC

Hi Guilherme 
 
Thanks for your update. 
 
We are happy to hear that the provided solution has been resolved your problem. 
 
Please get back to us if you need further assistance. 
 
Regards 
J Mohammed Farook 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;