2016-09-06 14 views
0

コンボボックスの選択に基づいてフォームコンテナの要素を表示/非表示するための支援を探しています。ExtJS 5.0.1コンボボックスの選択に基づいてグリッドを表示

"NSP Provider"がコンボボックス(id:carrierConnectivity)で選択されている場合にのみ、グリッド(id:NspList)に表示させます。誰にどのようにこれを達成することができるアイディアがありますか?以下のコードスニペット:

    { 
        xtype: 'container', 
        layout: 'vbox', 
        style: { paddingRight: '10px', paddingBottom: '10px' }, 
        items: [{ 
          xtype: 'combobox', 
          labelAlign: 'top', 
          fieldLabel: 'Connectivity Type', 
          id: 'carrierConnectivity', 
          name: 'connectivity_type', 
          store:['GRE', 'GRE - with internet peering', 'MPLS', 'Direct Leased Line', 'NSP Partner'], 
          width: 250, 

         }, 
         { 
          id: 'NspList', 
          flex: 1, 
          xtype: 'grid', 
          minHeight: 200, 
          maxHeight: 300, 
          width: 250, 
          selType: 'rowmodel', 
          title: 'NSP Providers', 
          forceFit: true, 
          bind: { store: '{nspnames}' }, 
          plugins: [ 
           Ext.create('Ext.grid.plugin.CellEditing', { 
            clicksToEdit: 2 
           }) 
          ], 
          columns: { 
           defaults: { 
            editor: 'textfield' 
           }, 
           items: [ 
            { text: 'Name', dataIndex: 'name'} 
           ] 
          }, 
          tools: [ 
           {type: 'plus', handler: 'addNsp'}, 
           {type: 'minus', handler: 'removeNsp'} 
          ] 
         } 

        ] 
       } 

答えて

2

コンボボックスを使用したい変更リスナーを持っています

listeners:{ 
    change:function(cb,newValue) { 
     cb.nextSibling().setVisible(newValue=="NSP Partner"); 
    } 
} 

チェックボックスにデフォルト値としてNSPパートナーを選択していないので、あなたがグリッドを構成する必要があります

hidden:true 
+0

これは完全に機能しました。アレキサンダー大変ありがとうございました。 – Jukebox

関連する問題