Reputation: 41
i am using primefaces 3.0 in my project, i have implemented the chart in testing1.xhtml, but that page content needs to display on main.xhtml, but the chart not rendering very first time. the chart rendering after giving the refresh only, but it should not come like this .. i have attached the model snippet for ur reference.. pls kindly help me to fix this issue..
testing1.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:portlet="http://java.sun.com/portlet"
xmlns:c="http://java.sun.com/jstl/core">
<h:form id="testForm">
<p:lineChart id="testChart" value="#{testBean.chart}"
style="float:left; margin-top:150px; border:0px; margin-left:0px; padding:0px; height:140px; width:230px; "/>
<h:form>
</ui:composition>
i am calling this page from main.xhtml
main.xhtml
<body onLoad="loadData();" >
<h:panelGrid style="height:33px;"/>
<h:form style="margin:0px; padding:0px;">
<p:remoteCommand name="loadData" action="#{testBean.chartLoad}" update="testChart" />
<p:panel style="height:auto; width:238px;" id="testPanel" header="Testing" closable="false" toggleable="true">
<ui:include src="testing1.xhtml"/>
</p:panel>
thanks in advance..
Upvotes: 1
Views: 2762
Reputation: 22
Remove the form tag in testing1.xhtml
Add in head section of the testing1.xhtml page the following:
<h:head>
<link rel="stylesheet" href="/javax.faces.resource/charts/charts.css.jsf?ln=primefaces"/>
......
</h:head>
Upvotes: 0
Reputation: 1
Remove tag from testing1.xhtml. Since your main page has a h:form tag you don't have to add another tag inside your ui:include.
And even if it isn't working then add an ID to and add update=":< yourGivenFormID >" in p:lineChart
Upvotes: 0
Reputation: 196
Just add these lines in page. There is a bug in loading js/css
<h:outputScript name="charts/charts.js" library="primefaces" />
<h:outputStylesheet name="charts/charts.css" library="primefaces" />
Upvotes: 1
Reputation: 37061
looks look a nested form
issue...
try to remove the <h:form id="testForm">
from within your inner page , cause its already surrounded by form
tag from outer page...
Upvotes: 2