New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pe:layout not rendered with PF 6.1.2 #463
Comments
I think it is related to this PF bug? |
Yes, It is exactly the same thing. |
So looking at your proposed fix I think it will work with people using PF 6.1.0 Public Release and the new Elite 6.1.2 which uses Jquery 2 and has this escape in it. |
I will fix this and I plan on doing a PFE 6.1.1 Release very very soon as I have fixed a few issues discovered since the 6.1.0 Release and I don't want to hold onto them until the 6.2.0 release. |
-1 to fix this in PFE |
Nope, it will not work on PF 6.1.0, since there's no
If you want I can code both solutions tomorrow |
Well, I just got my hands on a random PC, so here you are two different solutions:
core/src/main/java/org/primefaces/extensions/component/layout/LayoutRenderer.java
protected void encodeScript(final FacesContext fc, final Layout layout) throws IOException
{
final ResponseWriter writer = fc.getResponseWriter();
final String clientId = layout.getClientId(fc);
final WidgetBuilder wb = getWidgetBuilder(fc);
wb.initWithDomReady("ExtLayout", layout.resolveWidgetVar(), clientId);
wb.attr("clientState", layout.isStateCookie());
// REMOVED
// if(layout.isFullPage())
// {
// wb.attr("forTarget", "body");
// }
// else
// {
// wb.attr("forTarget", ComponentUtils.escapeJQueryId(clientId));
// }
// ADDED
String forTarget = layout.isFullPage() ? "body" : ComponentUtils.escapeJQueryId(clientId);
wb.append(",forTarget:\"" + forTarget + "\"");
core/src/main/resources/META-INF/resources/primefaces-extensions/layout/1-layout.js
PrimeFaces.widget.ExtLayout = PrimeFaces.widget.DeferredWidget.extend({
/**
* Initializes the widget.
*
* @param {object}
* cfg The widget configuration.
*/
init : function(cfg) {
this._super(cfg);
this.cfg = cfg;
this.id = cfg.id;
// REMOVED
//this.jq = $(cfg.forTarget);
// ADDED
if(cfg.forTarget == 'body') {
this.jq = $(document.body);
} else {
this.jq = $(PrimeFaces.escapeClientId(cfg.id));
} Nevertheless, even if backward compatible, they are just workarounds. Keep up the good work! |
fixed in PF |
OK I am going to close this issue since it currently works with 6.1. Public Release and will be fixed in PF Elite 6.1.3. |
We have since modified this fix to use the new WidgetBuilder.selectorAttr which does the proper Jquery escaping. #476 |
Hello,
try this simple snippet:
and nothing is displayed.
That's because this version of PF ships changes in
WidgetBuilder
:and now it escapes attribute values.
Inside
LayoutRenderer
:there's another escape, resulting in
cfg.forTarget: "#form\\:layout1"
(note the double backslash), which is unresolved by jQuery.The solution is very simple, just modify
LayoutRenderer
with:The text was updated successfully, but these errors were encountered: