How can I get the status of the "pressed" property of a button in ExtJS?

时间:2015-11-12 12:02:45

标签: javascript extjs

I have created a toggle button in ExtJS as:

{
    xtype: 'button',
    text: 'Edit Mode',
    id: 'editID',
    action: 'myToggle',
    pressed: false,
    enableToggle: true,
    margin: 5,
    handler: function (btn, e) {
        editMode(btn); // checks the status of the toggle button
    }
}

In some part in my script I want to check if the button is selected or not. I have tried several ways like:

var isChecked = Ext.get('editID').pressed; # gives undefined

Or

var parent_sub_id_isChecked = Ext.get('editID').dom.pressed; # also undefined

How can I get the status of the "pressed" property of a button in ExtJS?

1 个答案:

答案 0 :(得分:1)

这应该钉它

Ext.getCmp('editID').pressed

工作代码here

希望这有帮助!

相关问题