Sencha touch 以sencha touch的形式动态更改字段的bg颜色

Sencha touch 以sencha touch的形式动态更改字段的bg颜色,sencha-touch,extjs,Sencha Touch,Extjs,我是sencha touch的新手,我正在尝试动态更改字段的背景颜色 我知道有一种方法可以通过sass和copmass来实现,但是如果有人知道如何动态实现它 非常感谢,试试这个 LinePanel.Toolbar.getComponent("finBtn").el.setStyle( { backgroundColor: '#4F4F4F' }); 试试这个 LinePanel.Toolbar.getComponent("finBtn").el.setStyle( { backgroundCo

我是sencha touch的新手,我正在尝试动态更改字段的背景颜色

我知道有一种方法可以通过sass和copmass来实现,但是如果有人知道如何动态实现它

非常感谢,

试试这个

LinePanel.Toolbar.getComponent("finBtn").el.setStyle( { backgroundColor: '#4F4F4F' });
试试这个

LinePanel.Toolbar.getComponent("finBtn").el.setStyle( { backgroundColor: '#4F4F4F' });
您可以尝试:

Ext.getCmp('issue-estimated-hours').setStyle({backgroundColor: '#BA661B'});
其中“issue estimated hours”是我分配给表单字段的id,如下所示:

{
                    xtype: 'textfield',
                    label: 'Estimated Hours',
                    id: 'issue-estimated-hours',
                    name: 'estimated_hours',
                    readOnly: true
}
您可以尝试:

Ext.getCmp('issue-estimated-hours').setStyle({backgroundColor: '#BA661B'});
其中“issue estimated hours”是我分配给表单字段的id,如下所示:

{
                    xtype: 'textfield',
                    label: 'Estimated Hours',
                    id: 'issue-estimated-hours',
                    name: 'estimated_hours',
                    readOnly: true
}
你可以试试

Ext.getCmp('yourcomponentId').setCls('red')

在css中 红色 {背景色:红色}

你可以试试

Ext.getCmp('yourcomponentId').setCls('red')

在css中 红色
{background color:red}

您尝试过什么吗?查看您已经尝试过的内容很有帮助。是的,我已经尝试过:Ext.getCmp(“”).addCls(“”).Red(“”);CSS:.Red{背景色:Red!重要;}您尝试过什么吗?查看您已经尝试过的内容很有帮助。是的,我已经尝试过:Ext.getCmp(“”).addCls(“”).Red(“”);CSS:.红色{背景色:红色!重要;}