Results 1 to 5 of 5

Thread: Get Selected Row from a Editor Grid

  1. #1
    Sencha User
    Join Date
    Aug 2010
    Posts
    28

    Default Get Selected Row from a Editor Grid

    I'm trying to get the selected row from a editor grid.
    the selModel of the grid is
    Code:
    sm: new Ext.grid.RowSelectionModel({singleSelect:true})
    and in a button I need to get the id of the selected Row.
    I'm trying this code:
    Code:
     var linha = Ext.getCmp('grid_usuarios').getSelectionModel().getSelected();
    How I get the selected row when Click in a button like this:
    Code:
    var botao_delete = {
            text: decode_utf8('Excluir Usurio'),
            iconCls: 'deleta_user-icon',    
            handler : function(){
                var linha = Ext.getCmp('grid_usuarios').getSelectionModel().getSelected();
                 //console.log(linha.toSource());
                //Ext.Msg.alert('teste', linha.toSource());
            }
        };
    Thanks for the help.

  2. #2
    Sencha User
    Join Date
    Dec 2009
    Posts
    425

    Default

    var linha = Ext.getCmp('grid_usuarios').getSelectionModel().getSelected();

    linha will hold the selected Record.
    To get its id, say linha.id.

  3. #3
    Sencha User
    Join Date
    Aug 2010
    Posts
    28

    Default

    Quote Originally Posted by raj_plays View Post
    var linha = Ext.getCmp('grid_usuarios').getSelectionModel().getSelected();

    linha will hold the selected Record.
    To get its id, say linha.id.
    I'm trying to get the number of the row, not the Id of the row.
    Do you know how I do it?

  4. #4
    Sencha User
    Join Date
    Jan 2008
    Location
    Maryville, IL, US
    Posts
    288

    Default

    What do you mean by the number of the row? Some internal value in the columnModel? a numberColumn field?
    Since you didn't provide to much in the way of code, it is difficult for forum members to deduce what exactly it is that you are asking for (like what toSource() actually is supposed to do, or how you are defining your grid, column model and record type).

  5. #5
    Sencha User
    Join Date
    Dec 2009
    Posts
    425

    Default

    store.indexOf(linha)

Similar Threads

  1. Replies: 0
    Last Post: 29 Jun 2010, 12:17 PM
  2. EXT 3.0 - Row Editor Example- Parse Selected / Highlighted Rows
    By fuzelogic in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 30 Aug 2009, 12:54 PM
  3. [SOLVED]Grid row highlight leaves row selected color
    By josh803316 in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 11 Mar 2009, 5:18 PM
  4. Replies: 2
    Last Post: 27 Dec 2007, 6:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •