简体   繁体   English

如何在Tapestry的网格中实现寻呼机更改事件

[英]How to implement pager change event in Tapestry's grid

How to implement pager change event in Tapestry's grid? 如何在Tapestry的网格中实现寻呼机更改事件? I've read the documentation, but couldn't find the answer. 我已经阅读了文档,但是找不到答案。 So what I'm trying to do is, I want to reset the selectedItem to null everytime the selected page changing, and I noticed that actually setupRender() triggered, but I don't want to use it because it does a quite heavy process. 因此,我想做的是,每次选择的页面更改时,我都想将selectedItem重置为null ,我注意到实际上触发了setupRender(),但是我不想使用它,因为它执行的过程很繁琐。 There's no point to do this only for page changes. 仅对页面更改没有意义。 So is there any way to implement it specifically only for pager changes? 那么,有什么方法专门针对寻呼机更改来实现它吗? Thank you. 谢谢。 I'm using Tapestry 5.3.8 btw 我正在使用Tapestry 5.3.8 btw

If I understand your question correctly, you should implement your own GridPager and, for example, emit the event when a page is changing (you can then handle this event within page class). 如果我正确理解了您的问题,则应该实现自己的GridPager,例如在页面更改时发出事件(然后可以在页面类中处理此事件)。 For example: 例如:

@Events({ PAGE_CHANGE_EVENT, InternalConstants.GRID_INPLACE_UPDATE + " (internal event)" })
public class CustomeGridPager
{

    ...
    void onAction(int newPage)
    {
       currentPage = newPage;
       this.resources.triggerEvent(PAGE_CHANGE_EVENT, new Object[] { newPage }, null);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM