Sencha touch 2 要设置的分段按钮值按下不工作

Sencha touch 2 要设置的分段按钮值按下不工作,sencha-touch-2,uisegmentedcontrol,Sencha Touch 2,Uisegmentedcontrol,我正在创建一个分段按钮,我需要根据分段按钮的值修改应用程序 { margin : '5 -5 0 25', xtype: 'segmentedbutton', allowMultiple: true, height : 40, id : 'fontStyleBtn',

我正在创建一个分段按钮,我需要根据分段按钮的值修改应用程序

{

                    margin : '5 -5 0 25',
                    xtype: 'segmentedbutton',
                    allowMultiple: true,
                    height : 40,
                    id : 'fontStyleBtn',
                    items: [
                            {
                                text: 'B',
                                width : 50,
                                style: 'background-color:red !important',
                                action : 'boldText'
                            },
                        {
                            text: 'I',
                            width : 50,
                            style: 'font-size:14px;font-style:italic;background-color:#008c99',
                            action : 'italicText'
                        },
                        {
                            text: 'U',
                            width : 50,
                            style: 'font-size:14px;background-color:#008c99;text-decoration:underline',
                            action : 'underlineText'
                        }
                    ]}
当我点击B时,我的应用程序中的文本变得粗体。但我需要为它设置一个值,以便下次点击它时,可以将文本重置为正常

Ext.getCmp('fontStyleBtn').getItems()[0].pressed = true;
这似乎对我不起作用。

是否确实返回了“B”按钮

如果是,请尝试以下方法:


Ext.getCmp('fontStyleBtn').getItems()[0]。setPressed(true)

我将值放入数组中,并使用setPressedButtons()方法设置值。对我来说很好。