[CLOSED] Place focus in first row of grid

  1. #1

    [CLOSED] Place focus in first row of grid

    How can i do this programatically using javascript?
    Last edited by Daniil; Mar 20, 2012 at 7:39 PM. Reason: [CLOSED]
  2. #2
  3. #3
    i'm trying this:

    grdItems.getView().focusRow(0);
    But when i open the window the focus is not there. I want to set the focus in the first row so that the user is able to navigate the items with up and down keys. What am i missing?
    Last edited by Daniil; Mar 20, 2012 at 7:19 PM. Reason: Please use [CODE] tags
  4. #4
    Please try:
    <ext:Window runat="server">
        <Listeners>
            <Show Handler="if (grid.rendered) {
                                grid.getView().focusRow(0);
                            } else {
                                grid.on('viewready', function (grid) {
                                    grid.getView().focusRow(0);
                                });
                            }"
                    Delay="10" />
        </Listeners>
    </ext:Window>
  5. #5
    This worked:

                                        c.grdItems.getSelectionModel().selectFirstRow()                     
                                        c.grdItems.getView().focusRow(0);
  6. #6
    Another thing: Once the focus is on the row, if i press like alt+tab it won't go to the previous control (there is a button before the grid).
    Any workaround?
  7. #7
    There is no simple solution for that.

    Please investigate the following thread:
    http://forums.ext.net/showthread.php?17444
  8. #8
    New problems: under Firefox the first grid row gets focused, but sometimes i can't navigate the rows with up and down keys (the error is intermitent). Under IE and Chrome everything works fine.
    I've noticed (in the 3 browsers) that, despite the fact that the row seems to be focused, since it changes the color and i can navigate the rows (in firefox only sometimes), the focus seems to still be in the triggerfield that called the window, because it's border is black. Maybe that's what's causing the problem in firefox, because if i manually click the row with the mouse, the triggerfield seems to lose the focus (border gets grey) and i can navigate normally through the rows.
  9. #9
    Repeat myself, there is no simple solution for that.

    GridPanel has no Focus and Blur events.

    So, there might be issues.

    I'm afraid we can't help without a sample and exact steps to reproduce the problem. Please provide.

Similar Threads

  1. [CLOSED] Grid Focus
    By softmachine2011 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 05, 2012, 2:58 PM
  2. Replies: 0
    Last Post: Feb 08, 2011, 8:45 AM
  3. how to place Search For grid panel
    By Dinesh.T in forum 1.x Help
    Replies: 0
    Last Post: May 24, 2010, 10:16 AM
  4. [CLOSED] grid row focus
    By speedstepmem4 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 12, 2009, 1:18 PM
  5. [CLOSED] Focus on first row in grid?
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Dec 18, 2008, 7:12 AM

Posting Permissions