1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    18
    Answers
    1
    Vote Rating
    0
    eternasparta is on a distinguished road

      0  

    Default Unanswered: get a row from a grid

    Unanswered: get a row from a grid


    I think it's very simple to answer to this question:


    I have simple grid with my custom store:


    Code:
     //other code
         {xtype: 'grid',
                store:'SecondStore',
    	        itemId: 'mainTabPanel2',
    		    columns:[{header: 'Not Form Store', id:'keyId2',}, //this is not from the store
                         {header: 'From Store',  dataIndex: 'label', id:'keyId',}//from the store
         ]}
    the store only populate the second column with id: keyId. In fact it have:

    Code:
     fields: [
            {name: 'label'}]
    And this work well.


    I want to get from a function the row n°1 of this grid.


    Code:
     handler: function()
        {var grid =Ext.ComponentQuery.query('grid[itemId="mainTabPanel2"]')[0];
         //var row= get row(1) <- i don't know how to get the complete row
         }
    I'm working with ExtJs 4 so i can't get it with the comand
    grid.getView().getRow(1);


    I can't get it from the store because i want to get also the content of the column with id:keyId2 that is not stored in the store, so I can't do something like:


    Code:
     grid.getStore().getAt(1);
    Anyone know how to get the complete row in ExtJs 4?
    thank you!

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Answers
    124
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi eternasparta,

    You can use getRecords() method of the grid view class, like -
    Code:
    grid.getView().getRecords()[0];
    For more detail read the API docs-http://docs.sencha.com/ext-js/4-1/#!/api/Ext.view.Table-method-getRecords
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2012
    Posts
    41
    Answers
    6
    Vote Rating
    2
    sriram139 is on a distinguished road

      0  

    Default


    I think getNode() is what you are looking for.
    http://docs.sencha.com/ext-js/4-1/#!...method-getNode

    Try printing this HTLMElement and you can see complete row element that is rendered.

    Thanks,
    Sriram

  4. #4
    Sencha User
    Join Date
    Jan 2013
    Posts
    18
    Answers
    1
    Vote Rating
    0
    eternasparta is on a distinguished road

      0  

    Default


    thank you!

Thread Participants: 2

Tags for this Thread