Note that there are some explanatory texts on larger screens.

plurals
  1. POExtending Richfaces components
    primarykey
    data
    text
    <p>I'm looking to override the functionality of some Richfaces components (mostly the extendedDataTable).</p> <p>Could somebody provide a thorough example of any component they extended, with code examples?</p> <p>I know the below thread describes how to do it, but a code example would be hugely beneficial.</p> <p><a href="https://stackoverflow.com/questions/2348178/extend-richfaces-components-for-example-customize-datatable-component-for-speci">Extend Richfaces components - for example customize Datatable component for specific implementation</a></p> <hr> <p>Ok.....I've been trawling the internet and doesn't seem to be a whole lot of clear step by step simple examples of this. Seem to be the case here too :(</p> <p>I have managed to put together the following so far:</p> <p>I've created a custom ExtendedDataTableRenderer renderer as follows:</p> <pre><code>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); } } </code></pre> <p>And added the following to my faces-config.xml as follows:</p> <pre><code>&lt;render-kit&gt; &lt;renderer&gt; &lt;component-family&gt;org.richfaces.ExtendedDataTable&lt;/component-family&gt; &lt;renderer-type&gt;org.richfaces.ExtendedDataTableRenderer&lt;/renderer-type&gt; &lt;renderer-class&gt;com.test.HtmlExtendedDataTableRendered&lt;/renderer-class&gt; &lt;/renderer&gt; &lt;/render-kit&gt; </code></pre> <p>When I hit a page that has an entendedDataTable component this seems to be working (It is prining the test code to the console).</p> <p>Now I also extended the HtmlExtendedDataTable class as follows:</p> <pre><code>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); } } </code></pre> <p>Nothing is been printed to the console from within this class when I enter a page that has the extendedDataTable component.</p> <p>Could anybody provide me with some help as to why this is not working please?</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload