Add new item and focus

3 posts, 0 answers
  1. Randy Hompesch
    Randy Hompesch avatar
    148 posts
    Member since:
    Nov 2008

    Posted 17 Oct 2019 Link to this post

    Hi,

    When I hit the add button on a grid, I notice that the focus does not go to the first cell of the newly added row for editing. 

    This is kind of annoying. How can I force this?

    Thanks … Ed

         <TelerikGrid Data=@GridData
                             Pageable="true" Groupable="true" Sortable="true"
                             OnUpdate="@UpdateHandler" OnCreate="@CreateHandler" OnEdit="@EditHandler">
                    <GridColumns>
                        <GridColumn Field="Name" />
                        <GridColumn Field="IsActive" Title="Is Active">
                        
                        </GridColumn>
                        <GridCommandColumn Width="300px">
                            <GridCommandButton Command="Save" Icon="save" ShowInEdit="true">Update</GridCommandButton>
                            <GridCommandButton Command="Edit" Icon="edit">Edit</GridCommandButton>
                            <GridCommandButton Command="Cancel" Icon="cancel" ShowInEdit="true">Cancel</GridCommandButton>
                        </GridCommandColumn>
                    </GridColumns>
                    <GridToolBar>
                        <GridCommandButton Command="Add" Icon="add">Create Role</GridCommandButton>
                    </GridToolBar>
                </TelerikGrid>

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5701 posts

    Posted 17 Oct 2019 Link to this post

    Hi Ed,

    At the moment, there is no provision for this. Perhaps you could use the OnClick event of the Add Command Button to invoke a JS interop call that will find and .focus() the first input it finds on the grid, but this can become difficult if you have more grids rendered.

    There is already a feature request for defining a default focus in the grid and I suggest you Follow it to get status updates (I have added your Vote for your): https://feedback.telerik.com/blazor/1408647-specifying-which-field-should-have-focus-in-grid-editor.

    If you have suggestions on how this should be exposed for configuration, I encourage you to post them there.

     

    Regards,
    Marin Bratanov
    Progress Telerik

     UI for Blazor
  3. Randy Hompesch
    Randy Hompesch avatar
    148 posts
    Member since:
    Nov 2008

    Posted 17 Oct 2019 in reply to Marin Bratanov Link to this post

    Ok, thanks.

    Good to know it's in the pipeline.

     

Back to Top