ExtJS & IE7:简单窗口的渲染问题
我创建了这个非常简单的窗口扩展。在 Firefox 中,看起来应该如此,但在 IE7 中,包含的项目会从窗口中流出。
我该怎么解决这个问题?
代码:(Doctype很严格,但由于某种原因不会显示)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Online example</title>
<link rel="stylesheet" type="text/css" href="http://dev.sencha.com/deploy/dev/resources/css/ext-all.css" />
<script type="text/javascript" src="http://dev.sencha.com/deploy/dev/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://dev.sencha.com/deploy/dev/ext-all.js"></script>
</head>
<body>
<script type="text/javascript">
Ext.onReady(function(){
MyWindow = Ext.extend(Ext.Window, {
layout: 'fit',
width: 370,
height: 500,
resizable: true,
closable: true,
closeAction: 'hide',
collapsible: true,
autoScroll: true,
bodyStyle: 'padding:5px;',
title: 'Window',
initComponent: function () {
var config = {
items:
[
{
xtype: 'fieldset',
title: 'Buffer valg',
layout: 'form',
items:
[
{
xtype: 'numberfield',
fieldLabel: 'Label'
}, {
xtype: 'checkbox',
fieldLabel: 'Label',
checked: true
}
]
}
]
}
Ext.apply(this, Ext.apply(this.initialConfig, config));
// Config object has already been applied to 'this' so properties can
// be overriden here or new properties (e.g. items, tools, buttons)
// can be added, eg:
// Call parent (required)
MyWindow.superclass.initComponent.apply(this, arguments);
}
});
AWindow = new MyWindow();
AWindow.show();
});
</script>
</body>
</html>
I have created this very simple window extension. In Firefox it looks like it should, but in IE7, the contained items flow out of the window.
What can I do to fix this?
Code: (Doctype is strict, but won't display for some reason)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Online example</title>
<link rel="stylesheet" type="text/css" href="http://dev.sencha.com/deploy/dev/resources/css/ext-all.css" />
<script type="text/javascript" src="http://dev.sencha.com/deploy/dev/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://dev.sencha.com/deploy/dev/ext-all.js"></script>
</head>
<body>
<script type="text/javascript">
Ext.onReady(function(){
MyWindow = Ext.extend(Ext.Window, {
layout: 'fit',
width: 370,
height: 500,
resizable: true,
closable: true,
closeAction: 'hide',
collapsible: true,
autoScroll: true,
bodyStyle: 'padding:5px;',
title: 'Window',
initComponent: function () {
var config = {
items:
[
{
xtype: 'fieldset',
title: 'Buffer valg',
layout: 'form',
items:
[
{
xtype: 'numberfield',
fieldLabel: 'Label'
}, {
xtype: 'checkbox',
fieldLabel: 'Label',
checked: true
}
]
}
]
}
Ext.apply(this, Ext.apply(this.initialConfig, config));
// Config object has already been applied to 'this' so properties can
// be overriden here or new properties (e.g. items, tools, buttons)
// can be added, eg:
// Call parent (required)
MyWindow.superclass.initComponent.apply(this, arguments);
}
});
AWindow = new MyWindow();
AWindow.show();
});
</script>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
溢出有什么原因吗?我的意思是,恕我直言,Ext.Window 不应该真正有滚动条,我更改了您的代码,因此它删除了滚动条,并且还应该删除 IE 中的元素溢出错误:
如果情况并非如此,请告诉我。 。
Is there any reason for the overflow at all? I mean, an Ext.Window should not really have scroll bars imho, I changed your code so it removes the scroll bars, and it should also remove the element overflow bug in IE:
Let me know if this isn't the case...
我认为 Jaitsu 已经解决了这里的主要问题(使用
autoScroll: true
),但我必须指出另一个缺陷。为什么要写入initialConfig?
initialConfig 应该只包含传递给组件构造函数的配置。它在克隆组件时使用。甚至文档也说它是只读的。如果你不是 100% 确定那就不要这样做。此外,我不明白你为什么要这样做。当您像这样编写 initComponent 时,您的组件将正常工作:
I think Jaitsu already got the main issue here (the use of
autoScroll: true
), but I have to point out one other flaw.Why are you writing to initialConfig?
initialConfig should only contain the config that is passed to the constructor of the component. And it is used when cloning the component. Even the docs say it is read-only. If you aren't 100% sure then don't do it. Besides, I don't see why you would want to do it. Your component will work just fine when you write initComponent like so: