Hi,
it seams <p:resources /> is dynamically loading the needed css and js as required, but im loading my main content via AJAX from a navigation.
This means that my headers remain static although the content changes from one page to another via AJAX.
When a page is loaded with primefaces component, the necessary <p:resources /> are not present.
Questions:
- how do i dynamically update the <p:resources /> ?
- Or how can i load everything on <p:resources />, so everything are available when needed?
using old primefaces 1.1 as updating legacy.
Thanks
Updating <p:resources /> with dyanmic content from AJAX
-
- Posts: 55
- Joined: 08 Sep 2010, 09:18
- Location: Banja Luka, Bosnia and Herzegovina
- Contact:
I had the same problem. I solved it by adding dummy components on my template.
So the resources for these components are always included in head secton.
Code: Select all
<h:form id="dummy">
<p:dataTable style="display: none;"/>
<p:column style="display: none;"/>
<p:commandLink style="display: none;"/>
<p:commandButton style="display: none;"/>
<p:dialog/>
<p:fileUpload style="display: none;"/>
<p:tabView rendered="false">
<p:tab title=""/>
</p:tabView>
<p:message for="dummy"/>
<f:ajax event="click"/>
</h:form>
PrimeFaces version: whatever is the latest
Mojarra version: whatever is the latest
GlassFish & Tomcat version: whatever is the latest
Chrome & Firefox version: whatever is the latest
And a little bit of IE
Mojarra version: whatever is the latest
GlassFish & Tomcat version: whatever is the latest
Chrome & Firefox version: whatever is the latest
And a little bit of IE
-
- Posts: 55
- Joined: 08 Sep 2010, 09:18
- Location: Banja Luka, Bosnia and Herzegovina
- Contact:
Yeah, I know, but what can you do
PrimeFaces version: whatever is the latest
Mojarra version: whatever is the latest
GlassFish & Tomcat version: whatever is the latest
Chrome & Firefox version: whatever is the latest
And a little bit of IE
Mojarra version: whatever is the latest
GlassFish & Tomcat version: whatever is the latest
Chrome & Firefox version: whatever is the latest
And a little bit of IE
Hi,
If components are built programmatically and loaded per Ajax dynamically, you need an update of h:head component. Point to this component in the "update" (PF) / "render" (f:ajax) attribute. It should help you.
If components are built programmatically and loaded per Ajax dynamically, you need an update of h:head component. Point to this component in the "update" (PF) / "render" (f:ajax) attribute. It should help you.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin
I'll consider that if and when ever i get to use JSF 2.0, my current version does not seam to afford us that option to use h:head.
I might be wrong but it does not seem to be available in JSF 1.2.
Thanks
I might be wrong but it does not seem to be available in JSF 1.2.
Thanks
Certified: SCJP & SCWCD
Java, Seam 2.1, Struts, Hibernate 3, JSF, Richfaces, Primefaces, Quartz, MySQL.
Java, Seam 2.1, Struts, Hibernate 3, JSF, Richfaces, Primefaces, Quartz, MySQL.
-
- Posts: 55
- Joined: 08 Sep 2010, 09:18
- Location: Banja Luka, Bosnia and Herzegovina
- Contact:
I already tried that, but it didn't work. I was testing with Firefox, and when I refresh the h:head section, and right-click select 'View Page Source' the new head section is there, but Firefox doesn't actually load the new resources until full page refresh.If components are built programmatically and loaded per Ajax dynamically, you need an update of h:head component. Point to this component in the "update" (PF) / "render" (f:ajax) attribute. It should help you.
PrimeFaces version: whatever is the latest
Mojarra version: whatever is the latest
GlassFish & Tomcat version: whatever is the latest
Chrome & Firefox version: whatever is the latest
And a little bit of IE
Mojarra version: whatever is the latest
GlassFish & Tomcat version: whatever is the latest
Chrome & Firefox version: whatever is the latest
And a little bit of IE
Its probably due to browser caching , if indeed it was rerendered, it could be solved by appending random parameters to the resource if we had access to modify it or marking the resource as no-cache
ex. < src="/resource/file.js?342432342424">
ex. < src="/resource/file.js?342432342424">
Certified: SCJP & SCWCD
Java, Seam 2.1, Struts, Hibernate 3, JSF, Richfaces, Primefaces, Quartz, MySQL.
Java, Seam 2.1, Struts, Hibernate 3, JSF, Richfaces, Primefaces, Quartz, MySQL.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 45 guests