我正在使用 IE 10 并使用 ExtJs 4.1 开发了一个树面板。当我在 IE 10 中运行应用程序时,一切正常,但是一旦我切换到 IE 8(在 IE 10 中使用 IE 开发人员工具栏浏览器模式选项),我就会收到 JavaScript 错误。到目前为止,我从未见过 EXTJ 出现这种不一致的行为。
请使用以下小提琴重现该问题。
Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
renderTo: Ext.getBody(),
width: 400,
height: 400,
store: {
root: {
expanded: true,
children: [{
checked: false,
text: "1 detention",
expanded: true,
children: [{
checked: false,
text: '1.1 foo',
leaf: false,
children: [{
checked: false,
text: "1.1.1 India",
expanded: true
}, {
checked: false,
text: "1.1.2 Singapore",
expanded: true
}, {
checked: false,
text: "1.1.3 USA",
expanded: true
}]
}, {
checked: false,
text: '1.2 bar',
leaf: true
}]
}, {
checked: false,
text: "2 homework",
expanded: true,
children: [{
checked: false,
text: "2.1 book report",
leaf: true
}, {
checked: false,
text: "2.2 algebra",
expanded: true,
children: [{
checked: false,
text: "2.2.1 buy lottery tickets",
leaf: true
}, {
checked: false,
text: "2.2.2 buy lottery tickets 2",
leaf: true
}]
}, {
checked: false,
text: "2.3 English report",
leaf: true
}]
}, {
checked: false,
text: "3 buy lottery tickets",
leaf: true
}]
}
},
rootVisible: false,
disableSelection: true,
//selModel: {mode: 'SIMPLE'},
listeners: {
checkchange: function (record, checked, opts) {
if (!checked) return;
var parentNode = record.parentNode;
// Deselect children
function deselectChildren(record) {
record.eachChild(function (record) {
record.set('checked', false);
deselectChildren(record);
});
}
deselectChildren(record);
// See if all siblings are selected now
var allSiblingSelected = false;
if (parentNode) {
allSiblingSelected = parentNode.childNodes.reduce(function (previous, node) {
return previous && node.get('checked');
}, true);
}
if (allSiblingSelected) {
parentNode.set('checked', true);
// Apparently won't fire on its own
this.fireEvent('checkchange', parentNode, true, opts);
}
// Deselect ancestors
else {
while (parentNode) {
parentNode.set('checked', false);
parentNode = parentNode.parentNode;
}
}
}
}
});
我还附加了我在 IE 8 中遇到的错误
请提供您的建议。
谢谢