2013-02-18 68 views
0

我需要改變FormPanel中變化形式面板標題煎茶觸摸

在我的標題這裏是我的代碼

view.js 

    Ext.define('bluebutton.view.BlueButton.Loyalty', { 
    extend: 'Ext.Container', 
    xtype: 'loyaltycard', 
     requires: [ 

    'bluebutton.view.BlueButton.TransactionList', 
    'bluebutton.view.BlueButton.MemberPopUp', 
    'bluebutton.view.BlueButton.MemberDetail', 

     'bluebutton.view.BlueButton.CouponMain', 

    'bluebutton.store.BlueButton.MemberList', 
    'bluebutton.store.BlueButton.CouponList', 

    'Ext.ux.keypad.Keypad', 
    'Ext.Img', 
    'Ext.carousel.Carousel' 



    ], 
    config: { 
//  iconCls: 'add_black', 
//  title :'Loyalty Point', 
     styleHtmlContent: true, 
     cls: 'styledContent', 
//   
     layout: 'hbox', 
     border: 3, 
     ui: 'round', 

     defaults: { 
       margin : '10 10 10 10', 
       padding : 10 
      }, 

     items :[ 


      { 
       flex: 1, 

       xtype :'formpanel', 
       id:'loyaltyform', 
       items :[ 
        { 
         xtype: 'fieldset', 
         cls :'containerRadious' , 

         title: 'Welcome, new member ~<i><u>Kenny</u></i>', 
          defaults: { 
          labelWidth: '35%', 
          style: 'font-size:1.0em' 
         }, 
         items: [ 
          { 

           xtype: 'image', 
           src: 'resources/images/user3.png', 
           height: 100, 
           margin:20 

          }, 



          { 
           xtype: 'textfield', 
           name : 'Name', 
           label: 'Name', 
           value :'Kenny Chow', 
           readOnly: true 
          }, 
          { 
           xtype: 'textfield', 
           name : 'Age', 
           label: 'Age', 
           value :'20', 
           readOnly: true 
          }, 
          { 
           xtype: 'textfield', 
           name : 'Point', 
           label: 'Point Available', 
           value :'50', 
           id :'point', 
           readOnly: true 
          }, 
          { 
           xtype: 'textfield', 
           name : 'lastVisited', 
           label: 'Last Visited', 
           id :'lastVisited', 
           value :'27/12/2012 11:53 AM', 
           readOnly: true 
          }, 


          { 
           xtype:'button', 
           text: 'Scan', 
           width : '100%', 
           id: 'btnScan', 

          }, 




         ] 

        } 
       ] 

      }, 


      { 
       flex: 2, 
       xtype :'carousel', 
        cls :'containerRadious' , 

       items :[ 
        { 

         xtype :'keypad', 
          layout: { 
          type: 'hbox', 
           pack: 'center' 
         }, 
        }, 

        { 
         xtype:'couponlistcard' 


        } 


       ] 


      } 




     ], 


    } 

}); 

控制器

 onbtnAddClick: function (e) { 
       var loyaltyform = Ext.getCmp('loyaltyform'); 
       var pointAvalaible = Ext.getCmp('point').getValue(); 
       var keyPadValue = Ext.getCmp('keypad_value').getValue(); 
       var consumerID = Ext.getCmp('keypad_value').getValue(); 
      Ext.getCmp('loyaltyform').setTitle('Changed Title');; 

} 

,但我得到這個錯誤。

**Uncaught TypeError: Object [object Object] has no method 'setTitle'** 

以前有人遇到過這個問題嗎?請幫忙

回答

0

你得到這個錯誤的原因是因爲一個formpanel沒有方法setTitle()。要更改標題,您必須調用fieldsetsetTitle()方法,該方法位於您的窗體內部。所以給你FIELDSET一個ID,並使用此:

Ext.getCmp('yourFieldsetID').setTitle('Changed Title'); 

檢查您可以使用的面板連接字段集的方法,在煎茶文檔:

http://docs.sencha.com/touch/2-1/#!/api/Ext.form.Panel

http://docs.sencha.com/touch/2-1/#!/api/Ext.form.FieldSet

祝你好運!