捕获数据网格滚动的事件

发布于 2024-12-02 06:23:47 字数 106 浏览 1 评论 0原文

我有两个问题: 1. 捕获数据网格中发生滚动这一事实的事件是什么? 2. 当用户单击单元格然后拖出 datagid 时,是否有人对如何禁用 datagrid 的滚动有任何建议?

谢谢

I have 2 questions:
1. What would be the event to capture the fact a scroll has taken place in a datagrid?
2. Does anyone have any suggestions on how one could disable the scroll of the datagrid when a user clicks a cell then drags out of the datagid?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

坐在坟头思考人生 2024-12-09 06:23:47

我不太熟悉 DataGrid,但是 这是 DataGrid 的类文档我正在看。

查看 horizo​​ntalScrollPolicy 函数可能会有帮助

不管怎样,它看起来不像有滚动事件,所以我要做的是捕获滚动条上的 Event.CHANGE 事件并查看目标的属性了解有关滚动位置的更多信息。例如

function scrollChangeHandler(event:Event):void {
    trace(event.target.percentage); // or whatever the property is.
}
scrollBar.addEventListener(Event.CHANGE, scrollChangeHandler);

,此外,要终止事件,您可以在该事件上stopPropagation。例如

function mouseMoveHandler(event:MouseEvent):void {
    event.stopPropagation();
}
myItem.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);

,不幸的是,此信息只是您答案的一部分,但至少第二个提示将在以后多次提供帮助。希望我知道更多可以提供帮助。 祝你好运!

I'm not too familiar with the DataGrid, but here's the Class doc for the DataGrid which I was looking at.

It may be helpful to look at the horizontalScrollPolicy function.

Anyway, it doesn't look like there is a scroll event, so what I would do is capture an Event.CHANGE event on your scrollbar and look at the target's properties to find out more about the scroll position. eg

function scrollChangeHandler(event:Event):void {
    trace(event.target.percentage); // or whatever the property is.
}
scrollBar.addEventListener(Event.CHANGE, scrollChangeHandler);

Also, to kill an event you can stopPropagation on the event. eg

function mouseMoveHandler(event:MouseEvent):void {
    event.stopPropagation();
}
myItem.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);

Unfortunately, this info is only part of your answer, but at least that second tip will help a number of times down the road. Wish I knew more to help. Good luck!

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