【问题标题】:ICEfaces dataPaginator actionListenerICEfaces dataPaginator actionListener
【发布时间】:2013-02-24 21:12:44
【问题描述】:

ice:dataPaginator 中,我们可以添加actionListener。使用该事件处理程序或以其他方式,我们可以跟踪我们单击的分页按钮(锚点)吗?

【问题讨论】:

    标签: jsf icefaces


    【解决方案1】:

    是的,actionListener 方法采用 ActionEvent 参数,您可以在该参数上调用 getComponent() 并将其转换为 DataPaginator。有了这个对象,您可以使用getPageIndex()getPageCount()getPaginatorMaxPages() 方法。

    都写在ice文档中:http://icefaces-showcase.icesoft.org/showcase.jsf?grp=compatMenu&exp=paginator

    编辑:

    public void actionListener(ActionEvent event) {
        setStatus("Data Paginator clicked.");
    
        if ((event.getComponent() != null) &&
            (event.getComponent() instanceof DataPaginator)) {
            DataPaginator clicked = (DataPaginator)event.getComponent();
    
            StringBuilder sb = new StringBuilder(80);
            sb.append("Data Paginator clicked. Current page is ");
            sb.append(clicked.getPageIndex());
            sb.append(" of ");
            sb.append(clicked.getPageCount());
            sb.append(" and a maximum of ");
            sb.append(clicked.getPaginatorMaxPages());
            sb.append(" pages will be displayed.");
            setStatus(sb.toString());
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多