首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更改表单面板标题sencha touch

更改表单面板标题sencha touch
EN

Stack Overflow用户
提问于 2013-02-18 14:14:27
回答 1查看 1.5K关注 0票数 0

我需要在表单面板中更改我的标题

以下是我的代码

代码语言:javascript
复制
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'


                    }


                 ]


            }




        ],


   }

});

控制器

代码语言:javascript
复制
     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');; 

}

但是我得到了这个错误。

代码语言:javascript
复制
**Uncaught TypeError: Object [object Object] has no method 'setTitle'** 

以前有没有人遇到过这个问题?请帮帮忙

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-02-18 16:47:52

出现这个错误的原因是因为formpanel没有setTitle()方法。要更改标题,必须调用fieldsetsetTitle()方法,该方法位于表单面板中。所以给你fieldset一个ID并使用这个:

代码语言:javascript
复制
Ext.getCmp('yourFieldsetID').setTitle('Changed Title');

在Sencha文档中检查可用于panel en fieldset的方法:

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

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

祝好运!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14930491

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档