无法在 Chrome 中渲染面板。在 Firefox 中运行良好
我正在尝试在 extJS 3.4.0 中渲染面板。它在 Firefox 中运行良好,但当我在 Chrome 中尝试时出现以下错误:
未捕获类型错误:无法调用 null 的方法“applyStyles” Ext.Panel.Ext.extend.createElementext-all-debug.js:17057 Ext.Panel.Ext.extend.onRenderext-all-debug.js:17127 Ext.FormPanel.Ext.extend.onRenderext-all-debug.js:43353 Ext.extend.renderext-all-debug.js:10763 Ext.layout.ContainerLayout.Ext.extend.renderItemext-all-debug.js:13191 Ext.layout.AccordionLayout.Ext.extend.renderItemext-all-debug.js:14823 Ext.layout.ContainerLayout.Ext.extend.renderAllext-all-debug.js:13182 Ext.layout.ContainerLayout.Ext.extend.onLayoutext-all-debug.js:13168 Ext.layout.FitLayout.Ext.extend.onLayoutext-all-debug.js:13383 Ext.layout.ContainerLayout.Ext.extend.layoutext-all-debug.js:13162 Ext.layout.ContainerLayout.Ext.extend.runLayoutext-all-debug.js:13271 Ext.layout.ContainerLayout.Ext.extend.onResizeext-all-debug.js:13265 EXTUTIL.Event.fireext-all-debug.js:310 EXTUTIL.Observable.fireEventext-all-debug.js:54 Ext.Panel.Ext.extend.onBodyResizeext-all-debug.js:17670 Ext.Panel.Ext.extend.onResizeext-all-debug.js:17661 Ext.BoxComponent.Ext.extend.setSizeext-all-debug.js:12164 Ext.layout.FitLayout.Ext.extend.setItemSizeext-all-debug.js:13392 Ext.layout.FitLayout.Ext.extend.onLayoutext-all-debug.js:13385 Ext.layout.ContainerLayout.Ext.extend.layoutext-all-debug.js:13162 Ext.layout.CardLayout.Ext.extend.setActiveItemext-all-debug.js:13440 Ext.Container.Ext.extend.afterRenderext-all-debug.js:12738 Ext.Panel.Ext.extend.afterRenderext-all-debug.js:17414 Ext.extend.renderext-all-debug.js:10802 Ext.layout.BorderLayout.Ext.extend.onLayoutext-all-debug.js:13768 Ext.layout.ContainerLayout.Ext.extend.layoutext-all-debug.js:13162 Ext.Container.Ext.extend.doLayoutext-all-debug.js:12969 Ext.Container.Ext.extend.afterRenderext-all-debug.js:12743 Ext.extend.renderext-all-debug.js:10802 Ext.Componentext-all-debug.js:10641 Ext.apply.extend.sbext-base-debug.js:246 Ext.apply.extend.sbext-base-debug.js:246 Ext.apply.extend.sbext-base-debug.js:246(匿名 函数)Ydee.js:27 EXTUTIL.Event.nameext-all-debug.js:190 callext-all-debug.js:1459
我使用的代码是:
var userDlg = new myDialog();
var contentPanel = {
id: 'content-panel',
region: 'center',
layout: 'card',
margins: '2 5 5 0',
activeItem: 0,
border: false,
items: userDlg
};
var viewport = new Ext.Viewport({
layout: 'border',
title: 'Ext Layout Browser',
items: [contentPanel],
renderTo: Ext.getBody()
});
任何人都可以指出错误吗?
提前致谢。
I am trying to render a panel in extJS 3.4.0. It works well in Firefox but gives the following error when I try it in Chrome:
Uncaught TypeError: Cannot call method 'applyStyles' of null
Ext.Panel.Ext.extend.createElementext-all-debug.js:17057
Ext.Panel.Ext.extend.onRenderext-all-debug.js:17127
Ext.FormPanel.Ext.extend.onRenderext-all-debug.js:43353
Ext.extend.renderext-all-debug.js:10763
Ext.layout.ContainerLayout.Ext.extend.renderItemext-all-debug.js:13191
Ext.layout.AccordionLayout.Ext.extend.renderItemext-all-debug.js:14823
Ext.layout.ContainerLayout.Ext.extend.renderAllext-all-debug.js:13182
Ext.layout.ContainerLayout.Ext.extend.onLayoutext-all-debug.js:13168
Ext.layout.FitLayout.Ext.extend.onLayoutext-all-debug.js:13383
Ext.layout.ContainerLayout.Ext.extend.layoutext-all-debug.js:13162
Ext.layout.ContainerLayout.Ext.extend.runLayoutext-all-debug.js:13271
Ext.layout.ContainerLayout.Ext.extend.onResizeext-all-debug.js:13265
EXTUTIL.Event.fireext-all-debug.js:310
EXTUTIL.Observable.fireEventext-all-debug.js:54
Ext.Panel.Ext.extend.onBodyResizeext-all-debug.js:17670
Ext.Panel.Ext.extend.onResizeext-all-debug.js:17661
Ext.BoxComponent.Ext.extend.setSizeext-all-debug.js:12164
Ext.layout.FitLayout.Ext.extend.setItemSizeext-all-debug.js:13392
Ext.layout.FitLayout.Ext.extend.onLayoutext-all-debug.js:13385
Ext.layout.ContainerLayout.Ext.extend.layoutext-all-debug.js:13162
Ext.layout.CardLayout.Ext.extend.setActiveItemext-all-debug.js:13440
Ext.Container.Ext.extend.afterRenderext-all-debug.js:12738
Ext.Panel.Ext.extend.afterRenderext-all-debug.js:17414
Ext.extend.renderext-all-debug.js:10802
Ext.layout.BorderLayout.Ext.extend.onLayoutext-all-debug.js:13768
Ext.layout.ContainerLayout.Ext.extend.layoutext-all-debug.js:13162
Ext.Container.Ext.extend.doLayoutext-all-debug.js:12969
Ext.Container.Ext.extend.afterRenderext-all-debug.js:12743
Ext.extend.renderext-all-debug.js:10802
Ext.Componentext-all-debug.js:10641
Ext.apply.extend.sbext-base-debug.js:246
Ext.apply.extend.sbext-base-debug.js:246
Ext.apply.extend.sbext-base-debug.js:246 (anonymous
function)Ydee.js:27 EXTUTIL.Event.nameext-all-debug.js:190
callext-all-debug.js:1459
The code that I have used is:
var userDlg = new myDialog();
var contentPanel = {
id: 'content-panel',
region: 'center',
layout: 'card',
margins: '2 5 5 0',
activeItem: 0,
border: false,
items: userDlg
};
var viewport = new Ext.Viewport({
layout: 'border',
title: 'Ext Layout Browser',
items: [contentPanel],
renderTo: Ext.getBody()
});
Can anyone point out the error?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是因为我在 Viewport 而不是 Panel 内渲染 FormPanel。
手风琴布局在 FormPanel 中不起作用。当我将其更改为面板时,它开始工作。
我不知道为什么 Firefox 没有抱怨。
The problem was because I was rendering FormPanel inside Viewport instead of Panel.
Accordion layout wasn't functioning in FormPanel. When I changed it to Panel, it started working.
I am not sure why firefox wasn't complaining though.