0

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

{

                    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;

这似乎对我不起作用。

4

1 回答 1

0

Ext.getCmp('fontStyleBtn').getItems()[0]确实返回“B”按钮吗?

如果是,请尝试以下操作:

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

于 2012-06-28T08:52:11.070 回答