0
votes

My ExtJS grid is attached with action tbar, now in the handler of the toolbar buttons I need to have the grid instance. One way I can do it using

this.findByParentByType("grid"). Is there any better way that I can get the grid instance??

2
Put the snippet you are using. That may help to explain better. - Swar

2 Answers

2
votes

You can also use the ownerCt var to access the parent element. Based on the nesting level you will minimal need ownerCt.ownerCt from the button instance to access the grid. FindParentByType does basicly the same and checks each type. Firebug and console.log will help you with further debuging. EDIT:I forgot the Ext.getCmp that can be used to find an object by it's id.

0
votes

You can also get parent grid by giving scope scope:this to toolbar button, then in handler you will get grid instance in 'this' variable.