Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ext Js - Global access to objects
- Ext.onReady(function()
- {
- var tabs = Ext.getCmp('dynamic-tabs');
- var viewport = new Ext.Viewport(
- {
- layout: 'border',
- renderTo: document.body,
- items: [
- {
- region: 'north',
- height: 25,
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button', text: 'Início', iconCls: 'home',
- handler:function() {
- tabs.add({
- title: 'Início',
- html: 'Tab Body',
- closable:true
- }).show();
- }
- },
- {
- xtype: 'button', text: 'Sistema', iconCls: 'sistema',
- menu: {
- items: [
- {
- text: 'Usuários',
- iconCls: 'usuario',
- handler: function(){
- tabs.add({
- title: 'Usuários',
- html: 'Tab Body',
- closable:true,
- autoLoad: 'form.php'
- }).show();
- }
- },
- {
- text: 'Configurações',
- iconCls: 'sistema',
- handler: function(){
- tabs.add({
- title: 'Configurações',
- html: 'Tab Body',
- closable:true,
- autoLoad: 'form.php'
- }).show();
- }
- },'-',
- {
- text: 'Sair',
- iconCls: 'logoff',
- handler: function(){
- tabs.add({
- title: 'Sair',
- html: 'Tab Body',
- closable:true,
- autoLoad: 'form.php'
- }).show();
- }
- }
- ]
- }
- }
- ]
- }
- ,
- {
- region: 'center',
- xtype: 'tabpanel',
- id: 'dynamic-tabs',
- items: [
- {title: 'Início', autoLoad: 'iframe.php?url=form.php', active:true}
- ]
- }]
- });
- tabs.setActiveTab(0); // Throws: tabs is undefined
- });
- Ext.onReady(function(){
- **var tabs;**
- var viewport = new Ext.Viewport(
- {
- layout: 'border',
- renderTo: document.body,
- items: [
- {
- region: 'north',
- height: 25,
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button', text: 'Início', iconCls: 'home',
- handler:function() {
- tabs.add({
- title: 'Início',
- html: 'Tab Body',
- closable:true
- }).show();
- }
- },
- {
- xtype: 'button', text: 'Sistema', iconCls: 'sistema',
- menu: {
- items: [
- {
- text: 'Usuários',
- iconCls: 'usuario',
- handler: function(){
- tabs.add({
- title: 'Usuários',
- html: 'Tab Body',
- closable:true,
- autoLoad: 'form.php'
- }).show();
- }
- },
- {
- text: 'Configurações',
- iconCls: 'sistema',
- handler: function(){
- tabs.add({
- title: 'Configurações',
- html: 'Tab Body',
- closable:true,
- autoLoad: 'form.php'
- }).show();
- }
- },'-',
- {
- text: 'Sair',
- iconCls: 'logoff',
- handler: function(){
- tabs.add({
- title: 'Sair',
- html: 'Tab Body',
- closable:true,
- autoLoad: 'form.php'
- }).show();
- }
- }
- ]
- }
- }
- ]
- },{
- region: 'center',
- xtype: 'tabpanel',
- id: 'dynamic-tabs',
- items: [
- {title: 'Início', autoLoad: 'iframe.php?url=form.php', active:true}
- ],
- **listeners : {
- 'render' : function(){
- tabs = this;
- }
- }**
- }],
- });
- tabs.setActiveTab(0); // Throws: tabs is undefined
Add Comment
Please, Sign In to add comment