2016-04-04 11 views
1

extjs 4.2の新機能です。プロジェクト用のPOCを実行しています。extjs内のtab.panelに項目を追加できません

Just stuck at a point where am trying to add few more items to the tabs. 
Please find the code below. 
In tab1 I want add a textfield. 
But its not allowing and throwing a syntax error. 


####### 
    Ext.onReady(function() { 
    var textName={xtype:"textfield",fieldLabel:"username",margin:"10 10"}; 
    var tabObj=Ext.create("Ext.tab.Panel",{ 
    title: "Registration Form", 
    margin:"10 10 10 40", 
    plain:"false", 
    tabPosition:"bottom", 
    items : [ 
     { 
     title:"home", 
     html:"This is from Home Tab", 
     // xtype:"textfield",fieldLabel:"username",margin:"10 10"} 
     //textName 
     }, 
     { 
     title:"services" 
     }, 
     { 
     title:"stock" 
     } 
    ], 
    renderTo:Ext.getBody() 
    }); 
    }); 
####### 

docsで多くの助けが得られませんでした。 docsでは、html属性を持つタブを追加して、タブにコンポーネントを追加しない場合の例を示します。 ここをクリックしてください。

答えて

0

多分あなたは逃したitemsです。例えば

Ext.onReady(function() { 
     var textName = { 
      xtype: "textfield", 
      fieldLabel: "username", 
      margin: "10 10" 
     }; 
     var tabObj = Ext.create("Ext.tab.Panel", { 
      title: "Registration Form", 
      margin: "10 10 10 40", 
      plain: "false", 
      tabPosition: "bottom", 
      items: [{ 
       title: "home", 
       items: [ 
        textName 
       ] 
      }, { 
       title: "services" 
      }, { 
       title: "stock" 
      }], 
      renderTo: Ext.getBody() 
     }); 
    }); 

作業例:それが動作https://fiddle.sencha.com/#fiddle/1854

+0

ありがとう..... – satya

関連する問題