如何在组件ID作为参考的extjs中编辑/更新现有的组件CSS?

时间:2018-05-23 06:04:31

标签: extjs

我有弹出窗体组件,它具有表头标题页脚。如何借助表单容器componentID更新这些HTML元素的CSS。

我试过这些:

getComponent('stakeholderAddUserWindow').update({height: 1900});

getComponent('stakeholderAddUserWindow').addClass('newclass');

getComponent('stakeholderAddUserWindow').style: 'background-color: #5E99CC';

getComponent('stakeholderAddUserWindow').update({style: 'background-color: #5E99CC;'});

我还有其他疑问如何从容器遍历到内部子元素,这里我有3个子元素,类x-header,x-body,x-footer。我想将CSS应用到正文中。

<div class="x-window flex-window deploymentPlanWindow x-layer x-
window-default x-border-box" id="stakeholderAddUserWindow-1502" 
componentid="stakeholderAddUserWindow-1502">

  <div class="x-window-header x-header"id="stakeholderAddUserWindow-
  1502_header">header</div>

  <div class="x-window-body x-body"id="stakeholderAddUserWindow-
  1502_body">body</div>

  <div class="x-window-footer x-footer"id="stakeholderAddUserWindow-
  1502_footer">footer</div>

</div>

Ext.get(Ext.query('.x-window > .x-window-header')).setStyle('background', 'blue');

上面一个不工作

1 个答案:

答案 0 :(得分:1)

对于编辑样式,请使用componentselements

上的'setStyle'功能

要添加和删除课程,请使用addClsremoveCls函数

getComponent('stakeholderAddUserWindow').setStyle('height', '437px');