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

Grid cell edit (only one)

1 Answer 4 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kurt Landuyt
Top achievements
Rank 1
Kurt Landuyt asked on 22 Oct 2018, 12:36 PM

Hi all,

If you have cell edit enabled, the standard behavior is that after cell update the grid goes automatically to other cell (in edit mode). Would it be possible with a quick setting to only update one cell, and then continue in read only view.

I have users that update a cell and other cell is automatically set in update mode (not requested by the user).

Thanks in advance!

Best regards,

Kurt

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 25 Oct 2018, 11:33 AM
Hello Kurt,

You can achieve what you are going for by defining a custom Keyboard Command Provider. You can simply skip the BeginEdit command on the enter key. Here is what I have in mind:
public class CustomKeyboardCommandProvider : DefaultKeyboardCommandProvider
   {
       private GridViewDataControl parentGrid;
 
       public CustomKeyboardCommandProvider(GridViewDataControl grid)
        : base(grid)
       {
           this.parentGrid = grid;
       }
 
       public override IEnumerable<ICommand> ProvideCommandsForKey(Key key)
       {
           List<ICommand> commandsToExecute = base.ProvideCommandsForKey(key).ToList();
 
           if (key == Key.Enter)
           {
               commandsToExecute.Clear();
               commandsToExecute.Add(RadGridViewCommands.CommitEdit);
               commandsToExecute.Add(RadGridViewCommands.MoveNext);
           }
 
           return commandsToExecute;
       }
   }

Of course, you will need to set the command provider on the RadGridView instance like so: ("gridView" is the RadGridView name)
this.gridView.KeyboardCommandProvider = new CustomKeyboardCommandProvider(this.gridView);

Can you give this approach a try and see if it is suitable for your scenario?

Hope this helps.

Regards,
Vladimir Stoyanov
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Kurt Landuyt
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or