I had to make a custom extension of HtmlDataTable for a recent project. To do that I extended MyFaces HtmlDataTable:
//...
import org.apache.myfaces.component.html.ext.HtmlDataTable;
import org.apache.myfaces.component.UserRoleAware;
// ...
public class CustomPaginationHtmlDataTable extends HtmlDataTable implements
UserRoleAware {
//...
}
I also created a tag for my custom table:
import org.apache.myfaces.taglib.html.ext.HtmlDataTableTag;
public class CustomPaginationHtmlDataTableTag extends HtmlDataTableTag {
public String getComponentType()
{
return CustomPaginationHtmlDataTable.COMPONENT_TYPE;
}
public String getRendererType()
{
return "org.apache.myfaces.Table";
}
}
I then added the custom table to an appropriate faces-config.xml:
<faces-config>
<component>
<component-type>com.dbz.lms.faces.CustomPaginationHtmlDataTable</component-type>
<component-class>com.dbz.lms.faces.component.CustomPaginationHtmlDataTable</component-class>
</component>
<!-- more components -->
</faces-config>
and added the custom tag to an appropriate taglib file:
<tag>
<name>customPaginationDataTable</name>
<tagclass>com.dbz.lms.faces.taglib.CustomPaginationHtmlDataTableTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
</attribute>
<!-- more attribute declarations... -->
</tag>
At that point, the tag is available for use beneath whatever namespace you have defined for your custom tag library. I'm sure there's more information on the wiki: http://wiki.apache.org/myfaces/
Hope that helps,
James
-----Original Message-----
From: Alexandre Jaquet [mailto:[EMAIL PROTECTED]]
Sent: Wed 7/5/2006 10:44 AM
To: MyFaces Discussion
Subject: writing is own HtmlDataTable
I need to write my own table component and I need your advice to start it.
Do I need to extend an existing class ?
Wich step I've to follow ?
thx for your advice
Title: RE: writing is own HtmlDataTable
- RE: writing is own HtmlDataTable James Richards
- Re: writing is own HtmlDataTable Alexandre Jaquet
- RE: writing is own HtmlDataTable James Richards

