去除extjs自动添加的类
我是 Extjs 的新手。我在我的项目中使用 Extjs 4。加载 ext-all.js 时,它会自动将类添加到 标记中。我的所有其他 css 样式都更改为 extjs 样式。我在文档中发现将 Ext.scopeResetCSS 属性设置为 true,所以我添加如下。
Ext.onReady(function(){
new Ext.Component({
scopeResetCSS: true
});
});
但这并没有改变任何事情。我仍然有同样的问题。
有什么方法可以阻止 extjs 自动向标签添加 css 类吗?请帮助..
这是我生成多行消息框的代码。
<link rel="stylesheet" type="text/css" href="components/com_jobs/js/extjs/resources/css/ext-all.css"/>
<script type="text/javascript" src="components/com_jobs/js/extjs/ext-all.js"></script>
<!-- extjs message box code -->
<script type="text/javascript">
Ext.require([
'Ext.window.MessageBox'
]);
function removeBid(bidid){
Ext.MessageBox.show({
title: 'Address',
msg: 'Please enter your address:',
width:300,
buttons: Ext.MessageBox.OKCANCEL,
multiline: true,
//fn: showResultText
});
}
</script>
我做错了什么吗???我希望 extjs 仅设置其自己组件的样式。但现在 extjs 样式影响了我的整个页面。请帮忙。
谢谢。
I am new to Extjs. I am using Extjs 4 in my project. When the ext-all.js is loaded it automatically adds classes to the <body>
tag. and all my other css styles are changed with extjs styles. I found in the documentaion that to set Ext.scopeResetCSS property to true, so I add like below.
Ext.onReady(function(){
new Ext.Component({
scopeResetCSS: true
});
});
but it doesn't change any thing. I still have the same problem.
Is there any way to stop extjs from automatically adding css classes to the tags? Please help..
This is my code to generate a multi line message box.
<link rel="stylesheet" type="text/css" href="components/com_jobs/js/extjs/resources/css/ext-all.css"/>
<script type="text/javascript" src="components/com_jobs/js/extjs/ext-all.js"></script>
<!-- extjs message box code -->
<script type="text/javascript">
Ext.require([
'Ext.window.MessageBox'
]);
function removeBid(bidid){
Ext.MessageBox.show({
title: 'Address',
msg: 'Please enter your address:',
width:300,
buttons: Ext.MessageBox.OKCANCEL,
multiline: true,
//fn: showResultText
});
}
</script>
Am I doing anything wrong??? I want extjs to style only its own components. But now extjs styles are effects my whole page.. Please help.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用的是 ExtJS 4.0.2a,则 设置包含之前的scopeResetCSS。
但是,我刚刚切换到ExtJS 4.0.7,问题又回来了。 :(
If you are using ExtJS 4.0.2a, then set the scopeResetCSS BEFORE the include.
However, I just switched to ExtJS 4.0.7 and the issue is back. :(
在遇到这个问题之前,我对 ExtJS 4.2.1 提出了一个类似问题。我采用的解决方案是在加载 ExtJS 后修改 DOM,并为 DOMNodeInserted 事件添加一个侦听器,以监视和处理 ExtJS 组件(如选择列表)的自动创建。如果您有兴趣,可以在这里找到我的答案:https://stackoverflow.com/a/29934347/857209
I asked a similar question for ExtJS 4.2.1 before coming across this one. The solution I adopted was to modify the DOM once ExtJS was loaded, and add a listener for the DOMNodeInserted event to watch for and handle the automatic creation of ExtJS components like pick lists. If you are interested you can find my answer here: https://stackoverflow.com/a/29934347/857209
scopeResetCSS 属性是 Ext.buildSettings 的一部分,在 Ext JS 初始化序列的开始处使用。如果您想更改它,则必须编辑 ext-all.js 或更改 Sencha JS Builder 中的设置(我假设您没有使用它)。
在您最喜欢的文本编辑器(最好是可以处理较大文件的文本编辑器)中打开 ext-all.js 并在文件开头附近搜索“scopeResetCSS”,您会发现它很容易。
The scopeResetCSS property is part of Ext.buildSettings, which is used at the beginning of the Ext JS initialization sequence. If you want to change it, you have to edit ext-all.js or change the settings in the Sencha JS Builder (which I'm assuming you're not using).
Open ext-all.js in your favorite text editor (one that can handle larger files, preferably) and search for "scopeResetCSS" near the beginning of the file, and you'll find it easy enough.