Reputation: 97
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??
Upvotes: 0
Views: 1729
Reputation: 41
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.
Upvotes: 0
Reputation: 23983
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.
Upvotes: 2