You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Renzo Tomaselli <re...@tecnotp.it> on 2008/03/20 19:57:37 UTC

[Trinidad] tr:table varStatus not working for EL passed to included components

Hi, I noticed that when using the varStatus attribute of tr:table, it 
can be used into any local EL statement only.
If I use it inside any expression to be passed on to any included 
component, then that expression is evaluated to a constant (1).
E.g.:

<tr:table varStatus="statux" ...
    <tr:column>
        <tr:commandLink onclick="Click( 'foo:#{statux.index}');" ...

this works fine - providing the proper EL value for each row - while:

<tr:table varStatus="statux" ...
      <tr:column>
             <cx:valueHolder idBase="foo:#{statux.index}"/>

where cx:valueHolder is an included component having:

<ui:component>
    <tr:commandLink onclick="Click( 'foo:#{statux.index}');" ...

In this case, statux.index is evaluated to 1 for all rows, according to 
Firebug.
I suspect that this is a facelets issue, just wondering if anybody knows 
more about (and and workaround).

-- Renzo


   

Re: [Trinidad] tr:table varStatus not working for EL passed to included components

Posted by Andrew Robinson <an...@gmail.com>.
Could you whip up a quick and small demo and maybe I can find some time next
week to have a look?

-Andrew

On Fri, Mar 21, 2008 at 3:13 AM, Renzo Tomaselli <re...@tecnotp.it>
wrote:

>  No way, using ui:decorate yields pretty much the same results.
> Conversely - retrieving current row index from the bean works fine.
> I'm afraid this issue is going to be appended to a list of facelets
> mysteries.
>
> -- Renzo
>
>
> Andrew Robinson wrote:
>
> On Thu, Mar 20, 2008 at 2:20 PM, Renzo Tomaselli<re...@tecnotp.it> <re...@tecnotp.it> wrote:
>
>
>  Andrew, I don't use any template. Never used one, actually I rely
>  heavily on composition components (many placeholders, one page).
>  Maybe a trivial workaround for this issue is to have a row getter
>  returning the row index, since #{row} is evaluated properly within the
>  inner component.
>
>
>  ui:composition, ui:decorate, ui:include and facelets user tags are all
> pretty much the same TagHandler. They don't share code, but their code
> is all very similar.
>
> So when you say:
> "where cx:valueHolder is an included component having:"
>
> you are using a template. facelet template, include, user tag all boil
> down to a Facelet class instance. So try the code I gave you instead
> of using cx:valueHolder.
>
> -Andrew
>
>
>
>
>

Re: [Trinidad] tr:table varStatus not working for EL passed to included components

Posted by Andrew Robinson <an...@gmail.com>.
On Thu, Mar 20, 2008 at 2:20 PM, Renzo Tomaselli
<re...@tecnotp.it> wrote:
> Andrew, I don't use any template. Never used one, actually I rely
>  heavily on composition components (many placeholders, one page).
>  Maybe a trivial workaround for this issue is to have a row getter
>  returning the row index, since #{row} is evaluated properly within the
>  inner component.

ui:composition, ui:decorate, ui:include and facelets user tags are all
pretty much the same TagHandler. They don't share code, but their code
is all very similar.

So when you say:
"where cx:valueHolder is an included component having:"

you are using a template. facelet template, include, user tag all boil
down to a Facelet class instance. So try the code I gave you instead
of using cx:valueHolder.

-Andrew

Re: [Trinidad] tr:table varStatus not working for EL passed to included components

Posted by Renzo Tomaselli <re...@tecnotp.it>.
Andrew, I don't use any template. Never used one, actually I rely 
heavily on composition components (many placeholders, one page).
Maybe a trivial workaround for this issue is to have a row getter 
returning the row index, since #{row} is evaluated properly within the 
inner component.

-- Renzo

Andrew Robinson wrote:
> Try using ui:decorate instead of a user source tag to see if it is a
> problem with the UserTagHandler facelets class. Also simplify you
> template so that you eliminate other possible problems (also try
> swapping ui:component out with ui:composition to see if that has an
> effect):
>
> <tr:table varStatus="statux" ...
>   <tr:column>
>     <ui:decorate template="/facelets/valueHolder.xhtml">
>       <ui:param name="idBase" value="foo:#{statux.index}" />
>       <ui:param name="rowIndex" value="#{statux.index}" />
>     </ui:decorate>
>   </tr:column>
> </tr:table>
>
> /facelets/valueHolder.xhtml:
>
> <ui:composition>
>   Raw value: #{rowIndex} <br/>
>   Component EL value: <h:outputText value="#{rowIndex}" /> <br/>
>   In onclick: <tr:commandLink onclick="Click( 'foo:#{statux.index}');"
> .../> <br/>
> </ui:composition>
>
> They may look the same, but they are treated by facelets slightly
> differently so it may be worth trying the different permutations. As
> always with debugging, try to remove all unnecessary code and try to
> see if you can break or succeed with very simple code.
>
> Try using h:dataTable and h:commandLink to eliminate Trinidad as a
> potential problem (you can also try t:dataList or ui:repeat to test
> varStatus implementations in other libraries).
>
> After these tests, try the facelets mailing list to see if anyone there knows.
>
> -Andrew
>
>
>   

Re: [Trinidad] tr:table varStatus not working for EL passed to included components

Posted by Andrew Robinson <an...@gmail.com>.
Try using ui:decorate instead of a user source tag to see if it is a
problem with the UserTagHandler facelets class. Also simplify you
template so that you eliminate other possible problems (also try
swapping ui:component out with ui:composition to see if that has an
effect):

<tr:table varStatus="statux" ...
  <tr:column>
    <ui:decorate template="/facelets/valueHolder.xhtml">
      <ui:param name="idBase" value="foo:#{statux.index}" />
      <ui:param name="rowIndex" value="#{statux.index}" />
    </ui:decorate>
  </tr:column>
</tr:table>

/facelets/valueHolder.xhtml:

<ui:composition>
  Raw value: #{rowIndex} <br/>
  Component EL value: <h:outputText value="#{rowIndex}" /> <br/>
  In onclick: <tr:commandLink onclick="Click( 'foo:#{statux.index}');"
.../> <br/>
</ui:composition>

They may look the same, but they are treated by facelets slightly
differently so it may be worth trying the different permutations. As
always with debugging, try to remove all unnecessary code and try to
see if you can break or succeed with very simple code.

Try using h:dataTable and h:commandLink to eliminate Trinidad as a
potential problem (you can also try t:dataList or ui:repeat to test
varStatus implementations in other libraries).

After these tests, try the facelets mailing list to see if anyone there knows.

-Andrew

Re: [Trinidad] tr:table varStatus not working for EL passed to included components

Posted by Andrew Robinson <an...@gmail.com>.
>  <tr:table varStatus="statux" ...
>       <tr:column>
>              <cx:valueHolder idBase="foo:#{statux.index}"/>
>
>  where cx:valueHolder is an included component having:
>
>  <ui:component>
>     <tr:commandLink onclick="Click( 'foo:#{statux.index}');" ...

Try:
  <ui:component>
     <tr:commandLink onclick="Click( '#{idBase}');" ...