AdvancedDataGrid 水平/垂直滚动条问题。 (弹性)
所以,我有一个 AdvancedDataGrid 需要位于 Canvas 内。我的问题是,当你做这样的事情时,你会得到两组滚动条。此外,当您从右向左滚动时,AdvancedDataGrid 的水平滚动条会改变大小,并且不会让您一直滚动到右侧,这看起来很奇怪。
我已经关闭了 AdvancedDataGrid 的水平滚动功能,只让 Canvas 处理它。然而,当我这样做时,列不允许调整自身大小。啊。
我当前的“最佳”解决方案是让 AdvancedDataGrid 处理垂直滚动,让 Canvas 处理水平滚动,但这看起来很疯狂,更不用说我遇到了上面提到的问题,我无法再调整列的大小。
非常感谢任何帮助! 谢谢!
So, I have an AdvancedDataGrid that needs to live inside a Canvas. My problem is that when you do something like this you get two sets of scroll bars. Also, the horizontal scroll bar for the AdvancedDataGrid changes size as you scroll right to left and will not let you scroll ALL the way to the right, which seems odd.
I've turned horizontal scrolling off on the AdvancedDataGrid and let only the Canvas handle it. When I do that, however, the columns don't allow themselves to be resizable. Ugh.
My current "best" solution is to have the AdvancedDataGrid handle the vertical scrolling and the Canvas handle the horizontal scrolling, but this just seems insane, not to mention I get the problem I mentioned above where I can no longer resize columns.
Any help is greatly appreciated!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
AdvancedDataGrid 的水平滚动有些特殊,因为它根据可见列的宽度调整其水平滚动滑块的大小。实际上,您可以将拇指拖动到末尾,但这可能需要尝试几次。 (我知道,我知道...)
请记住,在 AdvancedDataGrid 中,在视口之外实际上没有渲染任何内容,因此任何大小调整都只是一个有根据的(好吧,有点有根据的)猜测。 Adobe 这样做是为了避免巨大的网格陷入困境(想象一下每次调整窗口大小时在 15,000 个单元格的 itemRenderer 上运行测量方法)。
我的建议是关闭 Canvas 中的垂直和水平滚动策略,并允许在 ADG 中处理滚动。它很丑陋,但它胜过其他选择。无论如何,ADG 都是一个笨重、脾气暴躁的装置,这可能就是 Adobe 将其开源的原因。我已经发誓很多次我再也不会使用它了。我只能在下次需要它的功能时才遵守这个誓言。大约每周一次。
The AdvancedDataGrid's horizontal scrolling is somewhat peculiar, in that it sizes its horizontal scroll thumb based on the width of the visible columns. You actually can drag the thumb to the end, but it might take a couple of tries. (I know, I know ...)
Remember that in the AdvancedDataGrid there is nothing actually rendered outside the viewport, so any sizing is just an educated (well, somewhat educated) guess. Adobe does this so that huge grids don't bog down to a crawl (imagine running measure methods on 15,000 cells' itemRenderers every time you resized the window).
My advice is to turn off both vertical and horizontal scroll policies in the Canvas and allow the scrolling to be handled in the ADG. It's ugly, but it beats the alternative. The ADG is a cumbersome, cantankerous contraption anyway, which may be why Adobe has open-sourced it. I have sworn many times I would never use it again. I've been able to keep that vow only until the next time I needed its features. Which is about every week.
AdvancedDataGrid 是画布中唯一的东西吗?
我会将 AdvancedDataGrid 的大小调整为完整的高度和宽度,并让 Canvas 处理滚动。
在画布中,重写 updateDisplayList 方法并执行如下操作:
这样 AdvancedDataGrid 应该没有滚动条。但是,如果它延伸到很下方或太右边,滚动条将出现在画布中。
阅读Flex 坐标系可能会对您有所帮助。 AdvancedDataGrid 是您的“内容”,而 Canvas 是您的本地内容。
我正在添加完整的运行代码示例来演示我的建议。
这是里面有 AdvancedDataGrid 的画布组件: com.flextras.stackOverflow.CanvasWithGrid
这是主应用程序文件:
Is the AdvancedDataGrid the only thing in your canvas?
I would size the AdvancedDataGrid to it's full height and width and let the Canvas handle scrolling.
In the canvas, override the updateDisplayList method and do something like this:
This way the AdvancedDataGrid should have no scroll bars. However, if it stretches to far down, or too far right the scroll bars will appear in the canvas.
You might benefit from reading up on the Flex Coordinate System. The AdvancedDataGrid is your "Content" while the Canvas would be your local.
I'm adding a full running code sample to demo my suggestion.
This is the canvas component with an AdvancedDataGrid inside it: com.flextras.stackOverflow.CanvasWithGrid
This is the main application file: