[ 
https://issues.apache.org/jira/browse/TOMAHAWK-548?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12577581#action_12577581
 ] 

phanidhar edited comment on TOMAHAWK-548 at 3/11/08 12:47 PM:
-------------------------------------------------------------------------

Since UIData supports value binding for the attribute "first" (getFirst is 
using it), Can we have setFirst push it to the valuebinding (if the 
valuebinding is present)?
In the current implementation setFirst only stores it locally thus makes the 
value binding useless.
By making setFirst to support pushing of the value to the value binding, one 
would have a mechanism to reset this value. i.e. when the datamodel is updated 
in the managed bean it can also modify the attribute used for value binding.

the method setFirst in UIData
{
        if (first < 0) {
            throw new IllegalArgumentException("Illegal value for first row: " 
+ first);
        }
        ValueBinding vb = getValueBinding("first");
        if(vb == null) {
           _first = new Integer(first); 
        }else
        {
             vb.setValue(context, new Integer(first));
        }

}


<t: datatable ... first=#{searchPageBean.firstRowIndex} >

the method searchPageBean.searchUIData can be as follows
{
  ... update the data model ...
  firstRowIndex = 0;
}
This does not eliminate the java code, but does not require the table component 
binding to the managed bean.

      was (Author: phanidhar):
    Since UIData supports value binding for the attribute "first" (getFirst is 
using it), Can we have setFirst push it to the valuebinding (if the 
valuebinding is present)?
In the current implementation setFirst only stores it locally thus makes the 
value binding useless.
By making setFirst to support pushing of the value to the value binding, one 
would have a mechanism to reset this value. i.e. when the datamodel is updated 
in the managed bean it can also modify the attribute used for value binding.

<t: datatable ... first=#{searchPageBean.firstRowIndex} >

the search method in myBean
This does not eliminate the java code, but does not require the table component 
binding to the managed bean.
  
> Ability to reset datascroller(UIData) to page one from a UICommand
> ------------------------------------------------------------------
>
>                 Key: TOMAHAWK-548
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-548
>             Project: MyFaces Tomahawk
>          Issue Type: Improvement
>          Components: Data Scroller, Extended Datatable
>            Reporter: Mike Kienenberger
>
> There should be a way to reset the datascroller back to page one when 
> clicking a UICommand without writing java code and binding the UIData to the 
> backing bean.
> Currently this has to be done as follows:
> <h:commandButton
>       value="Submit Query"
>       action="#{searchPageBean.search}"
>       actionListener="#{searchPageBean.resetDataScroller}">                   
>                 
> </h:commandButton>
> <t:dataTable id="searchResultsDataTable"
>       binding="#{searchPageBean.searchUIData}"
>     public void resetDataScroller(ActionEvent e)
>     {
>       searchUIData.setFirst(0);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to