You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by agdibugdi <sa...@avaya.com> on 2006/05/01 18:00:50 UTC

Re: Making sure DataTable's first always uses EL [was] Re: Facelets 1.0.14 causes duplicate IDs...

I extended HtmlDataTable with the override function for setFirst ( as
suggested), but it never got executed.

<snip>
<x:dataTable id="resourceData" var="MR"	
	value="#{MR.resources}" rows="10"
	columnClasses="columnspacer_5,leftcolumn,leftcolumn"
	headerClass="sortHeader" rowClasses="oddrow, evenrow" width="100%"
	sortColumn="#{MR.sort}"
	sortAscending="#{MR.ascending}"
	preserveDataModel="true" preserveSort="true"
	first="#{MR.searchPageIndex}"
	binding="#{MR.mrDataTable}">
</snip>

Any Help ?
Is it possible to post the code ?

Thanks a bunch,

vinod
--
View this message in context: http://www.nabble.com/Making-sure-DataTable%27s-first-always-uses-EL-was-Re%3A-Facelets-1.0.14-causes-duplicate-IDs...-t1462743.html#a4172242
Sent from the MyFaces - Users forum at Nabble.com.


Re: Making sure DataTable's first always uses EL [was] Re: Facelets 1.0.14 causes duplicate IDs...

Posted by Andrew Robinson <an...@gmail.com>.
I presume you modified your faces-config.xml to tell JSF to use your
component instead of HtmlDataTable? Example (note, I use facelets, and
if you don't you will also probably need to subclass the tag as well):

  <component>
    <component-type>com.somecompany.ExtendedELTable</component-type>
    <component-class>com.somecompany.ExtendedELUIData</component-class>
  </component>

custom.taglib.xml:
...
  <tag>
    <tag-name>dataTableEl</tag-name>
    <component>
      <component-type>com.somecompany.ExtendedELTable</component-type>
      <renderer-type>org.apache.myfaces.Table</renderer-type>
    </component>
  </tag>
...

Java:

public class ExtendedELUIData
  extends HtmlDataTable
{
  /**
   * @see javax.faces.component.UIData#setFirst(int)
   */
  @Override
  public void setFirst(int first)
  {
    ValueBinding vb = getValueBinding("first");
    if (vb != null)
    {
      vb.setValue(getFacesContext(), first);
      return;
    }
    else
      super.setFirst(first);
  }
}

That should be all that you need. You can add a System.out in your
constructor to make sure you component is getting created. Also check
the logs to make sure your component is getting used.

-Andrew

On 5/1/06, agdibugdi <sa...@avaya.com> wrote:
>
> I extended HtmlDataTable with the override function for setFirst ( as
> suggested), but it never got executed.
>
> <snip>
> <x:dataTable id="resourceData" var="MR"
>         value="#{MR.resources}" rows="10"
>         columnClasses="columnspacer_5,leftcolumn,leftcolumn"
>         headerClass="sortHeader" rowClasses="oddrow, evenrow" width="100%"
>         sortColumn="#{MR.sort}"
>         sortAscending="#{MR.ascending}"
>         preserveDataModel="true" preserveSort="true"
>         first="#{MR.searchPageIndex}"
>         binding="#{MR.mrDataTable}">
> </snip>
>
> Any Help ?
> Is it possible to post the code ?
>
> Thanks a bunch,
>
> vinod
> --
> View this message in context: http://www.nabble.com/Making-sure-DataTable%27s-first-always-uses-EL-was-Re%3A-Facelets-1.0.14-causes-duplicate-IDs...-t1462743.html#a4172242
> Sent from the MyFaces - Users forum at Nabble.com.
>
>