On 4/17/06, Andrew Robinson <[EMAIL PROTECTED]> wrote:
> Okay, I had to make a workaround and posting this here as an FYI to
> anyone who wants to do the same (or if someone has a better idea). The
> problem is the the default HtmlDataScroller sets the first to a
> integer. I needed the ability to have an EL expression so I could
> get/set this value in a backing bean.
> [...]
> Here is my workaround so that EL would always be used for first.
>
> 1) create a new class that extends
> org.apache.myfaces.component.html.ext.HtmlDataTable
> 2) Override setFirst:
> @Override
> public void setFirst(int first)
> {
> ValueBinding vb = getValueBinding("first");
> if (vb != null)
> {
> vb.setValue(getFacesContext(), first);
> return;
> }
> else
> super.setFirst(first);
> }
The way we've typically handled this situation of
EL-expression-or-constant in other attributes is:
public String getOperator()
{
if (_operator != null) return _operator;
ValueBinding vb = getValueBinding("operator");
return vb != null ?
_ComponentUtils.getStringValue(getFacesContext(), vb) : null;
}
public void setOperator(String operator)
{
this._operator = operator;
}
Then in the component code, we only use "getOperator()" rather than
directly access the _operator instance variable.
If datascroller isn't working this way, please open a JIRA issue with
a similar patch.