在两个高级DataGrid 之间调度事件
我有两个独立的 AdvancedDataGrid 实例(我们称它们为 A 和 B)。我想要做什么:当单击网格 A 时,我希望
- 网格 A 正常处理单击(即默认的 advanceDataGrid 行为)
- ,网格 B 接收某个位置的单击事件并使用 advanceDataGrid 默认行为处理此类事件(即无需为此类点击编写处理程序)。
这可能吗?
我已经设法将 MouseEvent.CLICK 派发给网格 B 并通过创建事件侦听器来处理此类事件,但实际上我希望网格 B 能够自行处理该事件(即无需重新编写处理程序),但事实似乎并非如此。 MouseEvent.CLICK 是正确的事件吗?
任何帮助、指示、建议将不胜感激。
谢谢你!
I have two separate advancedDataGrid instances (let's call them A and B). What I'd like to do: when clicking on grid A I'd like
- for grid A to handle the click normally (i.e. default advancedDataGrid behavior)
- for grid B to receive a click event a certain location and handle such event using advancedDataGrid default behavior (i.e. without having to write a handler for such click).
Is this possible?
I've managed to dispatchEvent a MouseEvent.CLICK to grid B and to handle such event by creating an event listener, but really I'd like for grid B to handle the event on its own (i.e. without having to re-rewrite a handler), and that doesn't seem to be the case. Is MouseEvent.CLICK even the right event?
any help, pointers, advice would be immensely appreciated.
thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果不使用事件侦听器,则无法在分派事件后执行代码。
我不清楚你到底想做什么,但没有理由不能在不属于它自己的对象上分派事件。而不是这样做:
您可以这样做:
如果 gridB 类中有一个默认处理程序来处理此类事件,则该处理程序应该触发;就像 gridB 自己的代码已调度该事件一样。
There is no way to execute code after an event is dispatched without using an event listener.
I'm unclear exactly what you're trying to do, but there is no reason why you can't dispatch an event on an object that is not it's own. Instead of doing:
You can do this:
And if there is a default handler in the gridB class to handle such an event, that handler should fire; just as if gridB's own code had dispatched the event.