You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Michael Heinen (JIRA)" <de...@myfaces.apache.org> on 2006/11/01 21:14:19 UTC

[jira] Reopened: (TOMAHAWK-764) ValueBinding lost for first attribute

     [ http://issues.apache.org/jira/browse/TOMAHAWK-764?page=all ]

Michael Heinen reopened TOMAHAWK-764:
-------------------------------------

             
Martin,

thanks for your quick responds.
But there is one mistake in your patch. Pls see getFirst in UIData:

public int getFirst()
{
    if (_first != null)
        return _first.intValue();
    ValueBinding vb = getValueBinding("first");
    Number v = vb != null ? (Number) vb.getValue(getFacesContext()) : null;
    return v != null ? v.intValue() : DEFAULT_FIRST;
}

When the first attribute of the datatable has been set ín the datascroller then the valueBinding is not evaluated any more in UIData's getFirst().
So you may not call uiData.setFirst(value) in case of an existing valueBinding in the DataScroller.
In this case the first attribute of UIData should stay null in order to evaluate the valueBinding.

So it must be:

if(uiData.getValueBinding("first")!=null)
{
    ValueBinding vb = uiData.getValueBinding("first");
    vb.setValue(getFacesContext(),new Integer(value));
}
else
{
   uiData.setFirst(value);
}

Regards,
Michael

> ValueBinding lost for first attribute
> -------------------------------------
>
>                 Key: TOMAHAWK-764
>                 URL: http://issues.apache.org/jira/browse/TOMAHAWK-764
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Extended Datatable
>    Affects Versions: 1.1.4-SNAPSHOT, 1.1.3
>         Environment: myFaces core1.1.4
> tomahawk 1.1.4 Snapshot
>            Reporter: Michael Heinen
>         Assigned To: Martin Marinschek
>             Fix For: 1.1.5-SNAPSHOT
>
>
> There is a major bug using the t:datatable in conjunction with the t:datascroller and a valueBinding for the first attribute.
> The HtmlDataScroller erases this value binding due to the fact, that it calls setFirst with an int in the broadcast method.
> If the page is then reloaded via ajax, then first contains a pagenumber instead of the valuebinding.
> Patch for setFirst:
>     public void setFirst(int first)
>     {
>       ValueBinding vb = getValueBinding("first");
>       if (vb != null)
>       {
>         //do nothing and keep the valueBinding
>         return;
>       }
>       else
>         if (_preservedDataModel != null)
>         {
>             //Also change the currently restored DataModel attribute
>             _preservedDataModel.setFirst(first);
>         }
>         super.setFirst(first);
>     }   
> see this threads:
> http://marc.theaimsgroup.com/?l=myfaces-user&m=116211813709147&w=2
> http://marc.theaimsgroup.com/?l=myfaces-user&m=114529361608223&w=2
> Michael

-- 
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