-
1. Re: extendedDataTable groupingColumn
ilya_shaikovsky Apr 26, 2010 6:18 AM (in response to ddg)1 of 1 people found this helpfulno unfortunatelly this feature is not reviewed and improved for such customization and works as it was contributed.
-
2. extendedDataTable groupingColumn
langer123 Feb 11, 2011 10:19 AM (in response to ilya_shaikovsky)Hi
My first post on the site! Relatively new to Richfaces.
I was wondering is there any way to extend the extendedDataTable base class to implement this feature?
It's actually a vital requirement of a feature I need to implement.
Thanks
-
3. extendedDataTable groupingColumn
nbelaevski Feb 15, 2011 3:35 PM (in response to langer123)Hi Thomas,
Try overriding this method: org.richfaces.component.UIExtendedDataTable.groupIsExpanded(int) or this: org.richfaces.component.UIExtendedDataTable.getState()
-
4. Re: extendedDataTable groupingColumn
langer123 Feb 17, 2011 6:48 AM (in response to nbelaevski)Thanks Nick.
Now to a more fundamental question
As I stated in my previous post, I'm new to JSF and Richfaces.
Would you be able to provide an example of an to override a component method (All steps and files required)?
Maybe for some simple component method you have done this on? (Doesnt have to be the extendedDataTable).
I cant seem to find any end-to-end simple example that shows how to overide an existing Richfaces component.
Appreciate your help.
-
5. Re: extendedDataTable groupingColumn
langer123 Feb 17, 2011 12:35 PM (in response to langer123)I've been trying to figure out how to do this and have the following so far:
I've created a custom ExtendedDataTableRenderer renderer as follows:
package com.test;
import java.io.IOException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import org.richfaces.renderkit.html.ExtendedDataTableRenderer;
public class HtmlExtendedDataTableRendered extends ExtendedDataTableRenderer
{
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException
{
System.out.println("------- in HtmlExtendedDataTableRendered init() -----");
// TODO Auto-generated method stub
super.encodeBegin(context, component);
}
}
And added the following to my faces-config.xml as follows:
<render-kit>
<renderer>
<component-family>org.richfaces.ExtendedDataTable</component-family>
<renderer-type>org.richfaces.ExtendedDataTableRenderer</renderer-type>
<renderer-class>com.test.HtmlExtendedDataTableRendered</renderer-class>
</renderer>
</render-kit>
When I hit a page that has an entendedDataTable component this seems to be working (It is prining the test code to the console).
Now I also extended the HtmlExtendedDataTable class as follows:
package com.test;
import java.io.IOException;
import javax.faces.context.FacesContext;
import org.richfaces.component.html.HtmlExtendedDataTable;
public class customExtendedDataTable extends HtmlExtendedDataTable {
/*
* The renderer type for this component.
*/
public static final String RENDERER_TYPE = "com.test.HtmlExtendedDataTableRendered";
public customExtendedDataTable() {
System.out.println("------- in customExtendedDataTable init() -----");
setRendererType(RENDERER_TYPE);
}
@Override
public String getFamily() {
return customExtendedDataTable.RENDERER_TYPE;
}
@Override
public boolean groupIsExpanded(int index)
{
System.out.println("------- in groupIsExpanded -----");
// TODO Auto-generated method stub
return super.groupIsExpanded(1);
}
@Override
public void encodeBegin(FacesContext context) throws IOException
{
System.out.println("------- in encodeBegin -----");
// TODO Auto-generated method stub
super.encodeBegin(context);
}
}
Nothing is been printed to the console from within this class when I enter a page that has the extendedDataTable component.
Could you provide me with some help as to why this is not working please?
Thanks