Ticket T552917
Visible to All Users

GridView - How to implement a shortcut to add a new row

created 8 years ago

[DevExpress Support Team: CLONED FROM T363560: ASPxGridView - Batch Edit - Provide cell focusing and keyboard navigation]
This isn't really good enough for users, surely there should be an easy way for them to create a new row, without potentially having to scoot about all over that grid?

Comments (1)
RB RB
Robert Bickers 8 years ago

    I half solved this problem by doing the following:

    Registering the key up event:

    HTML
    settings.Columns.Add(col => { .... col.Name = "myGrid" colProperties.ClientSideEvents.KeyUp = "MyJSController.Import.CreateNewRow"; });

    and then doing this :

    JavaScript
    Import: { CreateNewRow(s, e) { if (e.htmlEvent.keyCode == 13 || e.htmlEvent.keyCode == 9) { myGrid.AddNewRow(); } } }

    However, I would opt for anything that's built in to solve this same problem. It seems this method is a little temperamental, in that when I'm on that last column, it doesn't always accept the tab key as having been pressed

    Answers approved by DevExpress Support

    created 8 years ago

    Hello Robert,

    I've forwarded this scenario to our developers. They will discuss it when planning further development of the control.
    Now I can suggest you handle the client-side Init event of your GridView and implement your own shortcut to add a new row. In my sample I used the "F4" button:

    ASPx
    function OnInit(s, e) { ASPxClientUtils.AttachEventToElement(s.GetMainElement(), "keydown", function (evt) { if (evt.keyCode === 115) //key code of F4 button s.AddNewRow(); }); }

    Please review the attached project and let me know if this approach helps.

    Regards,
    Vova

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.