extjs 树面板中的滚动条不起作用

发布于 2024-11-25 06:54:29 字数 1080 浏览 2 评论 0原文

有时,我的树面板的滚动条不再起作用。虽然仍然可以移动滚动条,但树根本不再移动。我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心舞飞扬 2024-12-02 06:54:30

在 EXT 4.0 中,位于主库资源下的 ext-all.css 文件中,是这不起作用的真正原因。这个css文件的编码者决定网格单元应该有overflow:hidden;(大约第3324行):

.x-grid-cell {
    overflow: hidden;
    font: normal 13px tahoma, arial, verdana, sans-serif;
    user-select: none;
    -o-user-select: none;
    -ms-user-select: none;
    -moz-user-select: -moz-none;
    -webkit-user-select: none;
    cursor: default
}

.x-grid-cell-inner {
    overflow: hidden;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    padding: 3px 6px;
    white-space: nowrap
}

最好的办法是将溢出设置为继承两个类,这个问题很神奇走了。

唯一剩下的就是网格表的边框,但这可以通过在 css 中放置 css 样式来解决。我建议不要将其放在 ext-all.css 文件中。

.x-grid-table {
    border: none !important;
    width: auto !important;     
}

请记住,这将更改任何使用 .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):

.x-grid-cell {
    overflow: hidden;
    font: normal 13px tahoma, arial, verdana, sans-serif;
    user-select: none;
    -o-user-select: none;
    -ms-user-select: none;
    -moz-user-select: -moz-none;
    -webkit-user-select: none;
    cursor: default
}

.x-grid-cell-inner {
    overflow: hidden;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    padding: 3px 6px;
    white-space: nowrap
}

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.

.x-grid-table {
    border: none !important;
    width: auto !important;     
}

Just remember that this will change it for any style that uses .x-grid-cell.

提赋 2024-12-02 06:54:29

我也遇到过同样的问题。他们使用自定义滚动条,而且有很多错误(特别是在 Chrome 中)。要删除自定义滚动条,请将以下内容添加到配置中:

var tree = Ext.create('Ext.tree.Panel', {
  scroll          : false,
  viewConfig      : {
    style           : { overflow: 'auto', overflowX: 'hidden' }
  },
  // ...
});

我还没有在树面板中尝试过它。但它非常适合网格面板(因为树和网格都只是 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:

var tree = Ext.create('Ext.tree.Panel', {
  scroll          : false,
  viewConfig      : {
    style           : { overflow: 'auto', overflowX: 'hidden' }
  },
  // ...
});

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).

若能看破又如何 2024-12-02 06:54:29

在 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.

愛放△進行李 2024-12-02 06:54:29

我正在使用 Ext 4.0.7。

滚动:true

对我有用。但是,出于某种原因,有人补充道:

布局:锚

到树面板的配置,这导致它停止工作。如果您发现 scroll: true 不起作用,请尝试查看是否有人添加了布局并将其删除。

希望有帮助。

I'm using Ext 4.0.7.

scroll: true

works for me. But, for some reason, someone had added:

layout: anchor

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文