Dear Sirs,
I am so sorry to bother you again but I need to have a dynamic image list in the carousel.
JSF
<rich:dataGrid value="#{result.list}" var="r" >
...
<p:carousel value="#{r.images}" var="i" rows="1"
rendered="#{r.images.size > 0}">
<p:graphicImage value="#{i}" />
<h:outputText value="#{i.contentType}" />
</p:carousel>
</rich:dataGrid>
where result.list is
@DataModel
private List<W> list = new ArrayList<W>();
--------------------------
and W is:
@Name("w")
@AutoCreate
public class W implements Serializable {
@DataModel
private List<StreamedContent> images = new ArrayList<StreamedContent>();
public List<StreamedContent> getImages() {
return images;
}
public W() {
}
// DataEntity is a entity bean
public void setEntity(DataEntity e) {
if (e.getSons() == null)
return;
for (DataEntity x : e.getSons()) {
images.add(new DefaultStreamedContent(new ByteArrayInputStream(x.getData()), x
.getMime()));
}
}
/**
*
*/
private static final long serialVersionUID = -8106287009474660390L;
}
------------------------------------------------------------
I do not see any images despite the images list is correctly filled-up.
Please, what's wrong???
Kind regards,
Jakub
Dynamic p:graphicImage in carousel
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Hi,
Does <h:outputText value="#{i.contentType}" /> work? Only images fail? What does #{i} print?
Does <h:outputText value="#{i.contentType}" /> work? Only images fail? What does #{i} print?
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Can you post what p:graphicImage components render? Dynamic images are generated later after the page is rendered, they make a new request so in this new request if the value is not there anymore, this might occur. So just post what dynamic images render and we can continue discussing.
Here is what p:carousel rendered.
Hope it helps.
Thanks
Code: Select all
<script type="text/javascript">YAHOO.util.Event.addListener(window, "load", function() {
j_id14167376_36330bf7_widget = new PrimeFaces.widget.Carousel("j_id14167376_36330bf7:container", {pagerStateHolder:"j_id14167376_36330bf7:pagerstate", selectedItemStateHolder:"j_id14167376_36330bf7:selecteditem"});
j_id14167376_36330bf7_widget.set("numVisible",1);
j_id14167376_36330bf7_widget.set("animation", {speed:0.5});
j_id14167376_36330bf7_widget.render();
j_id14167376_36330bf7_widget.show();
});
</script>
<div id="j_id14167376_36330bf7">
<div id="j_id14167376_36330bf7:container">
<ol>
<li id="j_id14167376_36330bf7:0"><img id="j_id14167376_36330bf7:0:j_id14167376_36330bdd" src="/test-app/views/test_carousel.jsf?primefacesDynamicImage=i" />image/jpeg</li>
<li id="j_id14167376_36330bf7:1"><img id="j_id14167376_36330bf7:0:j_id14167376_36330bdd" src="/test-app/views/test_carousel.jsf?primefacesDynamicImage=i" />image/jpeg</li>
</ol>
</div>
<input id="j_id14167376_36330bf7:pagerstate" name="j_id14167376_36330bf7:pagerstate" type="hidden" />
<input id="j_id14167376_36330bf7:selecteditem" name="j_id14167376_36330bf7:selecteditem" type="hidden" />
</div>
Thanks
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Now I see, unfortunately it seems p:graphicImage does not support data iteration. So will not work in a carousel or a rich:dataGrid, we're aiming to add this support soon.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 60 guests