0

我正在使用 Ext 4.0.7 当我尝试如下初始化 Ext History 时:

Ext.require(['Ext.util.History']);

Ext.onReady(function(){  

   Ext.util.History.init();

});

我得到:
未捕获的类型错误:无法读取 null ext-all-debug.js:89797
Ext.define.startUp ext-all-debug.js:89797
Ext.define.init ext-all-debug.js 的属性“值”: 89858
(匿名函数)dashboard.js:5
(匿名函数)ext-all-debug.js:10122
call ext-all-debug.js:10078

有什么想法我可能做错了吗?

4

1 回答 1

1

在 4.1x 之前,您必须在 DOM 中有一个隐藏的表单才能使其正常工作。我的建议是升级到 4.1x 或添加一个初始化例程以在 init() 之前调用,如下所示:

 initialiseHistory: function () {
 this.historyForm = Ext.getBody().createChild({
 tag:    'form',
 action: '#',
 cls:    'x-hidden',
 id:     'history-form',
 children: [
 {
 tag: 'div',
 children: [
 {
 tag:  'input',
 id:   Ext.util.History.fieldId,
 type: 'hidden'
 },
 {
 tag:  'iframe',
 id:   Ext.util.History.iframeId
 }
 ]
 }
 ]
 });
 }
于 2012-10-17T20:42:11.753 回答