View Full Version : grid.up();

26 Jan 2015, 10:10 PM
Hello experts,
I am trying to get a grid with up( ) method, it works fine with same grid as this.up('id').
But when I am trying the same from another grid it returns undefined. What I the correct way to achieve it.

27 Jan 2015, 12:26 AM
Hi kishorkoli8,

Can you put code with specific tag [CODE] to explain more your problem...

27 Jan 2015, 12:32 AM
Thanks aaugen for your reply.

handler: function (grid, rowIndex, colIndex) {
var myGrid = this.up('stockgrid');

'stockgrid' is a different view name, and this handler is of different grid.

and both of these grids are on different tab panels.

27 Jan 2015, 12:50 AM
Be carreful of "this" use in your handler fonction.
In most cases, the value of keyword this is determined by how a function is called. It can't be set by assignment during execution, and it may be different each time the function is called.
If you want to get component located above your grid in DOM Hierarchie, use instead the grid parameter in your handler fonction:

handler: function (grid, rowIndex, colIndex) {
var myGrid = grid.up('stockgrid');

If you want to get component from different tap, you need to get first your tabpanel by up() method and after that your tab by down() method:

handler: function (grid, rowIndex, colIndex) {
var myGrid = grid.up('tabpanel').down('stockgrid');

27 Jan 2015, 1:16 AM
I have tried the way you suggested like,

var myGrid = grid.up('accrid').down('stockgrid');

but it gives,
TypeError: grid.up(...) is undefined (in firebug).

my tabpanel code is as follows

extend : 'Ext.tab.Panel',
alias : 'widget.twtabpanelview',
deferredRender: false,
//layout : 'fit',
// padding: '0 150 0 150',
renderTo : Ext.getBody(),
//title : "Document Selection",
plain : false,
height : 500,
tabPosition : "top",
items : [{
title : 'Document Selection',
xtype: 'acc',
id: 'accrid'
title : 'TW Grid Preview',


27 Jan 2015, 1:39 AM
thanks aaugen
It worked for me..thank you so much.=D>