I have created a Layout using ExtJs. It consists of a left menu and a main tabbed panel (the main components I am using are: Ext.tree.Panel and Ext.tab.Panel inside a Ext.Viewport)
Once a menu element is clicked it is loaded (via Ajax POST) in a tab. This is made using jQuery.
Once a certain button (inside a tab) is clicked, I must load some more content via Ajax. My question is how to access Ext elements in the scope of the tabs (which are created using a PHP-based MVC).
By example, how could I do something like this?:
var tab = mainPanel.getActiveTab();
alert('Current tab: ' + tab.title);
If you have configured your Ext.tab.Panel with an id (e.g. id: tabPanel):
You can use
tab = Ext.getCmp('tabPanel').getActiveTab()outside of Ext.onReadyExt.onReady doesn’t apply any scope it just delays loading the js it contains until the ExtJS library finishes loading.
EDIT: And then of course you could do
tab.title– I just noticed that.titleis not listed as a property in the Ext.tab.Tab API doc but I tested it and it is the correct usage.