myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger" <mkien...@gmail.com>
Subject Re: datatable with multiple images not interpretting rendered attribute
Date Wed, 13 Sep 2006 20:44:48 GMT
Are you using facelets?  You talked about using JSTL tags, and as far
as I know these are only available with Facelets.  I also see
functions in there, which again  makes me think you're using facelets.

If you define something with the c: tags, that only happens at compile
time, not at render time.

http://wiki.java.net/bin/view/Projects/FaceletsFAQ#What_s_the_difference_between_c

I recommend that you greatly simplify your example, and post the exact
page code here the expected results, and the actual results, so we're
better able to help you.   What you discussed earlier and what you
posted didn't match up, and there's so many references to index and
currentItemIndex in there that it's hard for us to guess which part
isn't working for you.

I use el expressions in rendered statements inside dataTable column
children without problems (with facelets).


On 9/13/06, Toppac <toppac@gmail.com> wrote:
>
> Thanks for the response but it definately does not work. For some reason when
> it is rendering the dataTable, whatever the first or last evaluation of the
> expression is, gets applied to every instance of the image within the
> datatable. It seems to cache the result of the EL expression for render and
> then use that for all the images at render time, rather than each image
> having its own value. I think this is a bug with myfaces
>
>
>
> Mike Kienenberger wrote:
> >
> > Of the code you posted, it looks ok to me.
> >
> > However, id="#{index + 'working'}" is not legal.   id must be a static
> > value.
> >
> >
> >
> > On 9/12/06, Toppac <toppac@gmail.com> wrote:
> >>
> >> I am trying to use a datatable to render bunch of data and display an
> >> image
> >> next to each row rendered based on the rowIndex. My code is below. The
> >> problem I am seeing is that inside the graphicImage tag, the index
> >> doesn't
> >> have scope. I can print the index before and after the graphicImage, but
> >> when used inside the rendered attribute it always rendered to empty
> >> string.
> >> I tried to use the index as part of the id for the graphicImage,
> >> something
> >> like id="#{index + 'working'}" and it always rendered to just "working".
> >> I
> >> have tried just using rowIndex, tried naming the rowIndexVar something
> >> other
> >> than index, and no luck. I am wondering how I can use the current index
> >> inside other tags. I have also tried using JSTL tags c:if to do the
> >> rendering and it looks like the index doesn't have scope inside there
> >> either.
> >>
> >> The only other thing I can think may be wrong is that that the rendered
> >> attribute of the graphicImage is only calculated once or is calculated
> >> and
> >> applied to all the rows. The last c:if I have in my code below does work,
> >> so
> >> it seems to only be something with the rowIndexVar inside a dataTable.
> >>
> >> Last thing, ignore typos in variable names, as I changed the names of the
> >> variables to hide the real function of this code (requirement). And
> >> currentItemIndex is a c:set var defined earlier in the page.
> >>
> >> <t:dataTable var="curItem" rowIndexVar="index"
> >> value="#{someData.someItems}"
> >> border="0" cellpadding="0" cellspacing="0">
> >>                         <t:column id="column1">
> >>                             <f:facet name="header">
> >>                                 <f:verbatim>&nbsp;</f:verbatim>
> >>                             </f:facet>
> >>                                         #{index} and #{currentItemIndex}
> >> and #{(index - currentItemIndex) eq 0}
> >>                                         <h:graphicImage alt="Working"
> >> rendered="#{(index - currentItemIndex) eq
> >> 0}" value="snapc/images/icons/working.gif" />
> >>                                         <h:graphicImage alt="Complete"
> >> rendered="#{sf:isCompleteItem(curItem)
> >> and ((index - currentItemIndex) ne 0)}"
> >> value="snapc/images/icons/complete.gif" />
> >>                                         <h:graphicImage alt="Incomplete"
> >> rendered="#{!sf:isCompleteItem(curItem) and ((index - currentItemIndex)
> >> ne
> >> 0)}" value="snapc/images/icons/red_arrow.gif" />
> >>                         </t:column>
> >>
> >>                         <t:column id="column2">
> >>                             <f:facet name="header">
> >>                                 <h:outputText value="Year" />
> >>                             </f:facet>
> >>                             #{curItem.currentlYear}
> >>                         </t:column>
> >>
> >>                        <t:column id="column3">
> >>                             <f:facet name="header">
> >>                                 <f:verbatim>&nbsp;</f:verbatim>
> >>                             </f:facet>
> >>                                         <c:if
> >> test="#{fn:length(someData.someItems) > 1}">
> >>                                         <h:commandLink action="edit"
> >> type="submit"
> >> id="edit">
> >>
> >> #{bundle.usage_editdetails_label}
> >>                                                 <f:param name="editIndex"
> >> value="#{index}"/>
> >>                                         </h:commandLink>
> >>
> >>                                         &nbsp;&nbsp;|&nbsp;&nbsp;
> >>                                         <h:commandLink action="delete"
> >> id="delete" >
> >>                                         #{bundle.usage_delete_label}
> >>                                                 <f:param
> >> name="deleteIndex" value="#{index}"/>
> >>                                         </h:commandLink>
> >>                                         </c:if>
> >>                         </t:column>
> >>                     </t:dataTable>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/datatable-with-multiple-images-not-interpretting-rendered-attribute-tf2261743.html#a6275415
> >> Sent from the MyFaces - Users forum at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/datatable-with-multiple-images-not-interpretting-rendered-attribute-tf2261743.html#a6293762
> Sent from the MyFaces - Users forum at Nabble.com.
>
>

Mime
View raw message