EXT JS:如何根据if条件隐藏项目的第四个选项卡?

时间:2017-03-31 04:56:45

标签: javascript extjs

我是ext js的新手,我试图根据某些实体条件隐藏屏幕上的第四个标签。因为,我编码我能够禁用 (模糊)第4个设置选项卡,但隐藏或隐藏()功能失败。

基本上,我想在特定条件下隐藏物品Payment.PaymentSettingsCfg中的第四个标签。 任何帮助都会非常感谢,提前谢谢。

var bsdataloded = false;
Payment.PaymentSettingsCfg = {
  id: 'PaymentSettingsPanel',
  title: getMsg('PaymentAdmin', 'PaymentSettingsHeader'),
  xtype: 'PaymentSettingsPanels',
  listeners: {
    activate: function() {
      if (!bsdataloded) {
        this.loadSettings();
        bsdataloded = true;

      }
    }
  }

}
var hidePaymentSettingcfg = false;
debugger;
if (Payment.EntitySettings &&
  Payment.EntSettings["EntSITE|Payment_SWitch"] === "Y") {
  Payment.PaymentSettingsCfg.disabled = true; //working
  // Payment.PaymentSettingsCfg.hidden  = true;// not working, even hide() not working
  hidePaymentSettingcfg = true;

}
init: function() {
  Ext.QuickTips.init();
  Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
    expires: null
  }));

  app = new Payment.admin.AppContainer({
    id: 'main-panel',
    title: Payment.getMsg('PaymentAdmin', 'PaymentConfHeader'),
    el: 'bodydiv',
    border: true,
    layout: 'fit',
    defaults: {
      border: false
    },
    items: [{
      xtype: 'tabpanel',
      activeTab: 0,
      width: 500,
      deferredRender: false,
      hidden: false,
      defaults: {
        border: false
      },
      items: [
        Payment.PaymentItemCfg,
        Payment.PaymentPeriodCfg,
        Payment.PaymentTypeCfg,
        Payment.PaymentSettingsCfg
      ]
    }]
  });
  app.render();
}

};
}();

2 个答案:

答案 0 :(得分:1)

以下是根据条件
来隐藏和显示标签的示例 我隐藏并显示复选框检查标签,但你可以得到你的想法 我希望它能帮助你 here is the Fiddle...

答案 1 :(得分:0)

为听众添加了逻辑并且它有效。

听众:{     afterrender:function(){

var testTab = this.getTabEl(3);
if (Payment.EntSettings["EntSITE|Payment_SWitch"] === "Y") {
    testTab.hide();
}

}

}