Bug:ExtJS树列表微视图在扩展作为弹出菜单一部分的节点时被破坏
我最近在当前树列表中发现了一个对我来说至关重要的错误: 复制步骤:Bug:ExtJS树列表微视图在扩展作为弹出菜单一部分的节点时被破坏,extjs,extjs7,Extjs,Extjs7,我最近在当前树列表中发现了一个对我来说至关重要的错误: 复制步骤: 打开门 点击“微型”按钮 将鼠标悬停在“主页”图标上以查看弹出式子导航 单击“存档”后面的箭头 结果是: 它正在关闭列表。当您再次将鼠标悬停在菜单上时,它将抛出一个js错误:uncaughtTypeError:cannotread constructor.unfloatAll(ext all debug.js:144478)处null的属性“un” 如果您再次将鼠标悬停在它上面,它将打开,列表将按预期展开 预期:展开其中一个子菜
uncaughtTypeError:cannotread constructor.unfloatAll(ext all debug.js:144478)处null的属性“un”
如果您再次将鼠标悬停在它上面,它将打开,列表将按预期展开
预期:展开其中一个子菜单时,悬停菜单将不会关闭。它将保持打开状态并正确扩展列表
这是在Ext6.2上运行的,而且至少在7.2版本(还没有测试过以前的版本)之后似乎已经崩溃了
如有任何变通办法或改写,将不胜感激
Ext.define('KitchenSink.view.grid.TreeListController', {
extend: 'Ext.app.ViewController',
alias: 'controller.tree-list',
onMicroPressedChange: function(button, pressed) {
var treelist = this.lookupReference('treelist'),
width = !treelist.getMicro() ? 44 : 250;
treelist.setMicro(!treelist.getMicro());
treelist.setWidth(width);
}
});
Ext.define('KitchenSink.view.grid.TreeListModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.tree-list',
stores: {
navItems: {
type: 'tree',
rootVisible: true,
root: {
expanded: true,
text: 'All',
children: [{
text: 'Home',
iconCls: 'x-fa fa-home',
children: [{
text: 'Messages',
iconCls: 'x-fa fa-inbox',
leaf: true
}, {
text: 'Archive',
href: '',
iconCls: 'x-fa fa-database',
children: [{
text: 'First',
iconCls: 'x-fa fa-sliders',
leaf: true
}, {
text: 'No Icon',
iconCls: null,
leaf: true
}]
}, {
text: 'Music',
iconCls: 'x-fa fa-music',
leaf: true
}, {
text: 'Video',
iconCls: 'x-fa fa-film',
leaf: true
}]
}, {
text: 'Users',
iconCls: 'x-fa fa-user',
children: [{
text: 'Tagged',
iconCls: 'x-fa fa-tag',
leaf: true
}, {
text: 'Inactive',
iconCls: 'x-fa fa-trash',
leaf: true
}]
}, {
text: 'Groups',
iconCls: 'x-fa fa-group',
leaf: true
}, {
text: 'Settings',
iconCls: 'x-fa fa-wrench',
children: [{
text: 'Sharing',
iconCls: 'x-fa fa-share-alt',
leaf: true
}, {
text: 'Notifications',
iconCls: 'x-fa fa-flag',
leaf: true
}, {
text: 'Network',
iconCls: 'x-fa fa-signal',
leaf: true
}]
}]
}
}
}
});
Ext.define('KitchenSink.view.grid.TreeList', {
extend: 'Ext.Panel',
requires: [
'Ext.list.Tree',
'Ext.list.TreeItem'
],
xtype: 'tree-list',
title: 'TreeList',
controller: 'tree-list',
layout: {
type: 'vbox',
align: 'stretch'
},
viewModel: {
type: 'tree-list'
},
items: [{
xtype: 'container',
flex: 1,
scrollable: 'y',
items: [{
xtype: 'toolbar',
docked: 'top',
border: false,
items: [{
xtype: 'button',
allowMultiple: true,
text: 'Micro',
handler: 'onMicroPressedChange'
}]
}, {
xtype: 'treelist',
reference: 'treelist',
bind: '{navItems}'
}]
}, {
xtype: 'component',
cls: 'treelist-log',
padding: 10,
height: 50,
bind: {
html: '{selectionText}'
}
}]
});
我通过覆盖树列表的onRefresh方法并删除onRootChange函数,避免静态树在expand上重新创建自己来解决这个问题。我个人有一个静态菜单,每次展开节点时都没有必要重新渲染它。然而,这一点在某些时候应该得到适当的解决。