extjs 树面板中的滚动条不起作用
有时,我的树面板的滚动条不再起作用。虽然仍然可以移动滚动条,但树根本不再移动。我在 Firefox 和 Chrome 中也遇到过这种情况。
这是我的树面板的来源:
var treeStore = Ext.create('Ext.data.TreeStore', { 代理人: { 类型:'ajax', 网址:'../tree.pl' } });
var tree = Ext.create('Ext.tree.Panel', { 商店:树商店, 渲染到:'树', 标题:“树”, 宽度:400, 身高:450, 根可见:假, 停靠项目:[{ xtype: '工具栏', 码头:'底部', 项目: [ { xtype: 'tbspacer', 宽度:340 }, { 文本:“搜索”, 处理程序:函数(){ 名称=[]; Ext.Array.each(tree.getView().getChecked(), 函数(rec){ 名称.push(rec.get('text')); });
resultStore.load({ params:{ search_type: 'tree', tree_nodes: names.join('II'), } }); } } ] }]
});
Sometimes it happens that the scrollbar of my tree panel does not work anymore. While it's still possible to move the scrollbar, the tree doesn't move at all anymore. That happens to me in Firefox and in Chrome as well.
Here is the source of my tree panel:
var treeStore = Ext.create('Ext.data.TreeStore', { proxy: { type: 'ajax', url: '../tree.pl' } });
var tree = Ext.create('Ext.tree.Panel', { store: treeStore, renderTo: 'tree', title: 'Tree', width: 400, height: 450, rootVisible:false, dockedItems: [{ xtype: 'toolbar', dock: 'bottom', items: [ { xtype: 'tbspacer', width: 340 }, { text: 'Search', handler: function(){ names = []; Ext.Array.each(tree.getView().getChecked(), function(rec){ names.push(rec.get('text')); });
resultStore.load({ params:{ search_type: 'tree', tree_nodes: names.join('II'), } }); } } ] }]
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 EXT 4.0 中,位于主库资源下的 ext-all.css 文件中,是这不起作用的真正原因。这个css文件的编码者决定网格单元应该有
overflow:hidden;
(大约第3324行):最好的办法是将溢出设置为继承两个类,这个问题很神奇走了。
唯一剩下的就是网格表的边框,但这可以通过在 css 中放置 css 样式来解决。我建议不要将其放在 ext-all.css 文件中。
请记住,这将更改任何使用
.x-grid-cell
的样式。In EXT 4.0, located within the ext-all.css file under resources of the main library, is the real reason that this doesn't work. The coders of this css file decided that the grid cell should have
overflow: hidden;
(around line 3324):The best thing to do is to set the overflow to inherit for both classes and this problem is magically gone.
The only thing left is the border of the grid table, but that can be taken care of by just placing css styling in your css. I advice not to place it in the ext-all.css file.
Just remember that this will change it for any style that uses
.x-grid-cell
.我也遇到过同样的问题。他们使用自定义滚动条,而且有很多错误(特别是在 Chrome 中)。要删除自定义滚动条,请将以下内容添加到配置中:
我还没有在树面板中尝试过它。但它非常适合网格面板(因为树和网格都只是 Ext.panel.Table 的扩展,该解决方案也应该适用于树面板)。
I've had the same problem. They use custom scrollbar and it's pretty buggy (especialy in chrome). To remove custom scroller add the following to the config:
I haven't tried it for treepanel. But it worked perfectly for the gridpanel (since both tree and grid are just extensions of Ext.panel.Table the solution should work for treepanel too).
在 Ext 4.1 中,自定义滚动条将再次被本机滚动条所取代。虚拟化滚动条的目的是支持无限滚动、列锁定等,但我相信在 4.1 中他们已经成功解决了这些问题,并且仍然保留了原生滚动条。如果 4.0.x 中当前的问题因此得到解决,我会感到惊讶。
The custom scrollers will be replaced with native scrolling again in Ext 4.1. The virtualized scrollers were intended to support infinite scrolling, column locking, etc. but I believe in 4.1 they've managed to solve those and still retain native scrollbars. I'd be surprised if the current issues in 4.0.x ever get resolved because of that.
我正在使用 Ext 4.0.7。
对我有用。但是,出于某种原因,有人补充道:
到树面板的配置,这导致它停止工作。如果您发现
scroll: true
不起作用,请尝试查看是否有人添加了布局并将其删除。希望有帮助。
I'm using Ext 4.0.7.
works for me. But, for some reason, someone had added:
to the configuration of the treepanel, which was causing it to stop working. If you find that
scroll: true
isn't working, try seeing if someone has added a layout and remove it.Hope that helps.