Hi all, 
I'm trying to extend the clay component to add some attributes, the idea is to 
calculate at runtime the jsfid based in the tag attribute values. The code is 
more complicated, but is something like this:

public class MyClass extends Clay {
    
    // ...

    public String getMyAttribute() {
        return myAttribute;
    }

    // ...

    public void encodeBegin(FacesContext ctx) throws java.io.IOException {
        // calculate jsfid 
        String jsfid = getRealJsfid(getMyAttribute());
        logger.debug("real jsfid: " + jsfid);

        setJsfid(jsfid);    
        super.encodeBegin(ctx);
    }
    
}

The calculated jsfid  is correct and these aproach works if the component is 
not inside a datatable. 

In the case the component is inside a datatable all the components are rendered 
with the first jsfid. eg:

<t:dataTable value="#{bean.values}" var="c">
    <t:column>
            <myComponent id="myId" myAtt="#{c}"/>
    </t:column>
</t:dataTable>

If c takes the values { '1', '2, '3' } ant the getRealJsfid() returns: 

    - 'tpl1.html' , if value = 1
    - 'tpl2.html',  if value = 2 
    - 'tpl3.html',  if value = 3

The log prints "tpl1.html", "tpl2.html" and "tpl3.html" as expected, but the 
three elements in the list are rendered with 'tpl1.html' !


Any idea ? Is these approach reasonable?


Thanks.

Reply via email to