2016-04-04 38 views
1

新增extjs 4.2.trying爲我的項目執行POC。無法將項目添加到tab.panel中extjs

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() 
    }); 
    }); 
####### 

在文檔中沒有得到太多幫助。 在文檔中,僅顯示示例以添加更多具有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

相關問題