1. #1
    Sencha User
    Join Date
    Apr 2010
    Posts
    5
    Vote Rating
    1
    herbpatterson is on a distinguished road

      0  

    Default Getting a handle to a grid from a selected row

    Getting a handle to a grid from a selected row


    How do you get a handle to the grid from a selected row event? I can't seem to find a way to do this via the event objects (RowModel and Model). Is there anyway to swim upstream from this event to get a handle to the grid (I don't want to query by id or type).

  2. #2
    Touch Premium Member
    Join Date
    Mar 2011
    Posts
    115
    Vote Rating
    7
    chamacs is on a distinguished road

      0  

    Default


    you can get the grid's selected item like this:

    Code:
    var record = gridPanel.getSelectionModel().getSelection()[0];
    where gridPanel is the component reference.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    4
    Vote Rating
    0
    Bloqs is on a distinguished road

      0  

    Default


    What do you mean by get a handle? If you are looking to get the information of the selected row in a grid, you can use this
    Code:
    gridRecord = grid.getSelectionModel().getSelection();  // Select the selected rows record = gridStore.getStore().getAt(gridRecord[0].index) // Select the information in the store of the first selected row

  4. #4
    Touch Premium Member
    Join Date
    Mar 2011
    Posts
    115
    Vote Rating
    7
    chamacs is on a distinguished road

      0  

    Default


    Oh you meant from the event to the grid.

    You should be able to use the 'up' function from the event's component. Something like:

    Code:
    button.up('gridpanel');

  5. #5
    Sencha User
    Join Date
    Apr 2010
    Posts
    5
    Vote Rating
    1
    herbpatterson is on a distinguished road

      0  

    Default


    Thanks - I was able to get a reference to the grid via:

    rowModel.view.up(...).

Thread Participants: 2