Completed
Last Updated: 26 Nov 2015 12:12 by Svetlin
Svetlin
Created on: 01 Nov 2012 06:39
Category: GridView
Type: Bug Report
0
FIX. RadGridView - the UserAddingRow, EditorRequired, UserAddedRow events are fired in wrong order when the new row is pinned at the bottom and TAB key is processed.
The events are fired in the following order: UserAddingRow, EditorRequired, UserAddedRow eventfired when the new is pinned at the bottom and TAB key is processed.

Workaround:

public class FixGridNewRowBehavior : GridNewRowBehavior
{
    protected override bool ProcessTabKey(System.Windows.Forms.KeyEventArgs keys)
        {
            bool isInEditMode = this.EditorManager.IsInEditMode;
 
 
            if (isInEditMode)
            {
                IGridNavigator navigator = GridViewElement.Navigator;
 
                bool isLeftNavigation = navigator.IsFirstColumn(GridViewElement.CurrentColumn) && keys.Shift;
                bool isRightNavigation = navigator.IsLastColumn(GridViewElement.CurrentColumn) && !keys.Shift;
 
                if (isLeftNavigation || isRightNavigation)
                {
                    this.GridViewElement.EndEdit();
                }
 
                if (isLeftNavigation)
                {
                    navigator.SelectLastColumn();
                }
                else if (isRightNavigation)
                {
                    navigator.SelectFirstColumn();
                }
 
                if (isLeftNavigation || isRightNavigation)
                {
                    GridViewElement.BeginEdit();
                    return true;
                }
            }
 
            return base.ProcessTabKey(keys);
        }
} 

BaseGridBehavior gridBehavior = this.radGridView1.GridBehavior as BaseGridBehavior;
gridBehavior.UnregisterBehavior(typeof(GridViewNewRowInfo));
gridBehavior.RegisterBehavior(typeof(GridViewNewRowInfo), new FixGridNewRowBehavior());
0 comments