You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "David Paterson (JIRA)" <de...@myfaces.apache.org> on 2006/12/13 23:19:23 UTC

[jira] Commented: (MYFACES-47) pageSelectionListener tag for dataScroller tag

    [ http://issues.apache.org/jira/browse/MYFACES-47?page=comments#action_12458286 ] 
            
David Paterson commented on MYFACES-47:
---------------------------------------

I've had a very similar problem but came up with a different solution that may be a bit simpler.  I'm a bit new to JSF but it seemed to be the right way to go.  As Catalin Kormos  notes there is no easy way out of the box to keep the Datatable.first and BackingBean.rowIndex (or whatever the name may be) in sync.  You can add t:updateActionListeners to any links on a row in the table but what if you want to have a refresh button or any other kind of button where you want to keep the page index intact and return to the same page.

My solution was to modify the the component class broadcast() method and the ScrollerEvent class.   I added private int firstRowIndex to ScrollerActionEvent and moved the call to     broadcastToActionListener below where the logic is that calcuates the new value for uiData.first:
            ...
            scrollerEvent.setFirstRowIndex(uiData.getFirst());
            broadcastToActionListener(scrollerEvent);

With that attribute added to the event all you then have to do is add the actionListner to your backing bean and your uiData.first and BackingBean.rowIndex are in sync. :

    public void scrollerAction(ActionEvent event) {
        ScrollerActionEvent scrollerEvent = (ScrollerActionEvent) event;
        setRowIndex(scrollerEvent.getFirstRowIndex());
    }

It's worked great for me.

 It's been very useful for me.

> pageSelectionListener tag for dataScroller tag
> ----------------------------------------------
>
>                 Key: MYFACES-47
>                 URL: http://issues.apache.org/jira/browse/MYFACES-47
>             Project: MyFaces Core
>          Issue Type: New Feature
>    Affects Versions: 1.0.8 beta
>         Environment: All
>            Reporter: Catalin Kormos
>         Assigned To: Martin Marinschek
>         Attachments: pageSelectionListener-component-patch-final, pageSelectionListener-tlds-patch-final
>
>
> I needed a solution to receive notifications about the page selection of a dataScroller for a dataTable; so, i've implemented a new "pageSelectionListener" tag that can be nested inside the dataScroller tag, very similar to "tabChangeListener" for tabbedPane. It works, i've tested it, and created a patch for the new org.apache.myfaces package and tlds. I would like to submit the patch, but don't know how. Could someone point me in the right direction?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira