Harry,

I have made a wiki page [1] on this subject. Under the current implementation, you have to supply the glue for this yourself. (i.e. the attribute "first" can be considered read-only)

Dev team - this question gets asked a lot. Maybe it is time to change the behaviour of t:dataTable/t:dataScroller to be more intuitive?

[1] http://wiki.apache.org/myfaces/ManagingDataScrollerPage

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Harry Co wrote:
Hi all,

I wondering about something sounding odd.
It appears that binding a variable  to argument "First" in UIData (ex:
HtmlDataTable) does not cause the binding method to be called when value
changes.
*More explicitly:*
I have a dataTable like this (I've removed other not releavant arguments):
    *<t:dataTable first="#{myDataListBean.myBeanListStart}">*
    *MyDataBean* is a managed bean  scoped "session" and holds an integer
attribute  called "myBeanListStart".
When I try to change the value of "myBeanListStart" by some dataScrolling
(<t:dataScroll>), HtmlDataScroller.broadcast(...) is called and calls in
turn getUIData().setFirst(...).
But surprise, the implementation of UIData modifies its own "first" argument
and not MyDataListBean.myBeanListStart even if a proper setMyBeanListStart
exists on MyDataListBean.
Here's the code of UIData (myFacaes 1.1.3):



public void setFirst(int first)
    {
        if (first < 0) {
            throw new IllegalArgumentException("Illegal value for first
row: " + first);
        }
        _first = new Integer(first);
    }

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

Does someone knows why UIData acts like that? Is there anyway to get
myBeanListStart modified this way?

TIA.

Harry.



Reply via email to