我用的是Ext3.20,在htm页中同时引用文件aa.js、bb.js文件,在IE6,IE7浏览htm页,关闭带有图型的Tab页,IE会报错。
但是,只引用cc.js文件,在IE下浏览就不会报错,两种写法效果是一样的。
可是把LineChart对象render到DIV时IE就报错。
我现在的办法是在关闭带有图型的tab页时,隐藏它。
不知道,各位解决我遇到的这个问题有没有更好的办法??
aa.js 文件内容如下:
Ext.onReady(function() {
var mytabpanel = new Ext.TabPanel({
title: 'mytab',
id: 'tabmal',
enableTabScroll: true,
width: 586,
height: 368,
activeTab: 0,
items: [{
title: 'index',
id: 'indextab',
html: '<div id="index"></div>'
}]
});
var mywin = new Ext.Window({
title: 'mywin',
width: 600,
height: 400,
items: mytabpanel
});
var tabs = Ext.getCmp('tabmal');
for (var x = 0; x < 1; x++) {
var ctab = tabs.add({
id: 'add' + x,
title: 'add' + x,
closable: true,
//items: cp
html: '<div id="add1' + x + '"></div>'
}).show();
tabs.setActiveTab(ctab);
}
mywin.show();
});
bb.js文件内容如下:
Ext.onReady(function() {
var store = new Ext.data.JsonStore({
fields: ['name', 'visits', 'views'],
data: [
{ name: 'Jul 07', visits: 245000, views: 3000000 },
{ name: 'Aug 07', visits: 240000, views: 3500000 },
{ name: 'Sep 07', visits: 355000, views: 4000000 },
{ name: 'Oct 07', visits: 375000, views: 4200000 },
{ name: 'Nov 07', visits: 490000, views: 4500000 },
{ name: 'Dec 07', visits: 495000, views: 5800000 },
{ name: 'Jan 08', visits: 520000, views: 6000000 },
{ name: 'Feb 08', visits: 620000, views: 7500000 }
]
});
var cp = new Ext.chart.LineChart({
store: store,
//renderTo: 'add0',
xField: 'name',
yField: 'visits',
listeners: {
itemclick: function(o) {
var rec = store.getAt(o.index);
Ext.example.msg('Item Selected', 'You chose {0}.', rec.get('name'));
}
}
});
cp.render('add10');
});
cc.js文件内容如下:
Ext.onReady(function() {
var store = new Ext.data.JsonStore({
fields: ['name', 'visits', 'views'],
data: [
{ name: 'Jul 07', visits: 245000, views: 3000000 },
{ name: 'Aug 07', visits: 240000, views: 3500000 },
{ name: 'Sep 07', visits: 355000, views: 4000000 },
{ name: 'Oct 07', visits: 375000, views: 4200000 },
{ name: 'Nov 07', visits: 490000, views: 4500000 },
{ name: 'Dec 07', visits: 495000, views: 5800000 },
{ name: 'Jan 08', visits: 520000, views: 6000000 },
{ name: 'Feb 08', visits: 620000, views: 7500000 }
]
});
var cp = new Ext.chart.LineChart({
store: store,
xField: 'name',
yField: 'visits',
listeners: {
itemclick: function(o) {
var rec = store.getAt(o.index);
Ext.example.msg('Item Selected', 'You chose {0}.', rec.get('name'));
}
}
});
var mytabpanel = new Ext.TabPanel({
title: 'mytab',
id: 'tabmal',
enableTabScroll: true,
width: 586,
height: 368,
activeTab: 0,
items: [{
title: 'index',
id: 'indextab',
html: '<div id="index"></div>'
}]
});
var mywin = new Ext.Window({
title: 'mywin',
width: 600,
height: 400,
items: mytabpanel
});
var tabs = Ext.getCmp('tabmal');
for (var x = 0; x < 1; x++) {
var mm = tabs.add({
id: 'add' + x,
title: 'add' + x,
closable: true,
items: cp
}).show();
tabs.setActiveTab(mm);
}
mywin.show();
});