We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9207 ☆ A M B ☆
    • 2,475 Posts
    I'm using Ext JS on a custom resource class, and I've pre-pended a couple tabs to the list of tabs so our read from left to right "CUSTOM TAB", "Document", "Settings", "Resource Groups". We would like to have the content editing field NOT appear on this first tab. I'm not sure how to turn that off/on in the Ext JS. Does anyone know? Thanks!
      • 33976 ☆ A M B ☆
      • 571 Posts
      What you could do is use the TabPanel tabchange event, check if the active tab is your custom tab, if so, get the main content field & hide it (Ext.getCmp('id').hide()), else show it (cmp.show()).

      Hope that might help
        • 9207 ☆ A M B ☆
        • 2,475 Posts
        Thanks Romain. That got me to the solution. Here's what I came up with:

        Ext.onReady(function(){
        	var tabPanel = Ext.getCmp("modx-resource-tabs");
            
        	if(tabPanel!=null){
        		//Add my custom tab
        		var customTab = {
        			title: 'Custom',
        			id: 'my-custom-tab',
        			cls: 'modx-resource-tab',
        			layout: 'fit',
        			labelAlign: 'top',
        			labelSeparator: '',
        			bodyCssClass: 'tab-panel-wrapper main-wrapper',
        			autoHeight: true,
        			defaults: {
        				border: false,
        				msgTarget: 'under',
        				width: 400,
        				height:800
        			},
        			items: [
                        {
                            xtype: "box",
                            autoEl: {cn: '<div id="target_id"></div>'}
                        }
        			]
        		};
                tabPanel.on('tabchange', function(parent,selectedTab){ 
                    if (selectedTab.id == 'my-custom-tab') {
                        Ext.getCmp("modx-resource-content").hide();
                    }
                    else {
                        Ext.getCmp("modx-resource-content").show();
                    }
                });
        		tabPanel.insert(0, customTab);
        		tabPanel.setActiveTab(0);
        		tabPanel.doLayout();
        	}
        });


        Ext JS honestly ranks amongst the worst documentation I've ever seen because it includes almost no real examples. I am continually amazed at how those guys at Sencha are able to mastermind solutions to impossible problems and be completely unable to explain anything useful about it.
          • 11838 ☆ A M B ☆
          • 79 Posts
          I am a poor coder, more a designer kind. I need to hide content field from a specific tab i created with form customisation, i found this thread but i have no idea how to implement that. Is it a plugin ondocformrender ? Should i create a js file ?