-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I have a problem. When the window is loading we see the following message: "Failed to process setattr zkoss - ZK."
Show the message for a moment and then finish loading the window.
Would there be any way that this message does not come out?
Browser: IE 11 ZK version: 8.0.4
Hi RicardoRivas, welcome to the forum.
This message indicates that a JavaScript function went wrong and tried to access an undefined value, or a value on an undefined attribute.
When this happen, there should be a trace in your JS console (in browser's developer tools) which should give more info on what went wrong. Please paste it here with the whole stack trace below it so that we can have a more in-depth look :)
if you can also give a short description of what kind of action trigger the issue, would also be helpful.
Hi MDuchemin, thank you for you answer.
The following trace is shown on my JS console.
SCRIPT5007: Unable to get value of the property 'innerHTML': object is null or undefined zk.wpd (23,7705)
This trace is only displayed when it is running in IE. This problem happens when I press a button to change pages. At the moment the page is loading, this message is displayed for a moment and then the page loads normally.
Hi MDuchemin, here i paste the stack trace.
The object return for the function s.$n() is:
th class="z-column z-column-sort" id="sXAPl" style="text-align: left;">
When parentNode is done on this object it fails
STACKTRACE: [Subproceso principal]
zFlex.fixFlex [Line: 24, Col: 3974], zk.wpd zFlex.onSize [Line: 24, Col: 3522], zk.wpd n [Line: 13, Col: 1123], zk.wpd fire [Line: 13, Col: 854], zk.wpd o [Line: 13, Col: 2700], zk.wpd fire [Line: 13, Col: 3549], zk.wpd fire [Line: 16, Col: 6227], zk.wpd h [Line: 21, Col: 6908], zk.wpd
[Llamada asincrónica] d [Line: 21, Col: 9761], zk.wpd bH.event.dispatch [Line: 9, Col: 54118], zk.wpd cb.handle [Line: 9, Col: 50286], zk.wpd
[Llamada asincrónica] bH.event.add [Line: 9, Col: 50915], zk.wpd Anonymous function [Line: 9, Col: 60913], zk.wpd each [Line: 9, Col: 5930], zk.wpd bH.prototype.each [Line: 9, Col: 2184], zk.wpd on [Line: 9, Col: 60885], zk.wpd bH.fn[e] [Line: 9, Col: 83632], zk.wpd Anonymous function [Line: 21, Col: 10098], zk.wpd b2 [Line: 9, Col: 31197], zk.wpd ca.fireWith [Line: 9, Col: 32201], zk.wpd ready [Line: 9, Col: 3623], zk.wpd
[Llamada asincrónica] bH.ready.promise [Línea: 9, Col: 8092], zk.wpd bH.prototype.ready [Línea: 9, Col: 2229], zk.wpd bH.prototype.init [Línea: 9, Col: 1789], zk.wpd bH [Línea: 9, Col: 222], zk.wpd Anonymous function [Línea: 9, Col: 36106], zk.wpd Anonymous function [Línea: 9, Col: 33957], zk.wpd Global code [Línea: 9, Col: 2], zk.wpd
Hi Ricardo, From your description, it looks like the column is no longer attached to the page, but is still trying to resize itself. Stacktrace is somewhat difficult to parse, since it's using minified code.
I'd recommend activating debug-js mode (display non-minified JS in browser) with : <client-config> <debug-js>true</debug-js> </client-config> in zk.xml
Also, could you give me a small overwiew of where this column is located? If you can make a fiddle to reproduce, that'be helpful :) (bumped your karma to enable links in your posts)
Hi MDuchemin, I have activated debug mode. I attached the stack trace. It seems that the method that generates this problem is _docResize. Do you know when this method is called?
zFlex.fixFlex [Línea: 21602, Col: 4], zk.wpd
zFlex.onSize [Línea: 21570, Col: 3], zk.wpd
_invoke [Línea: 12829, Col: 5], zk.wpd
fire [Línea: 12812, Col: 7], zk.wpd
_fire [Línea: 12955, Col: 5], zk.wpd
fire [Línea: 13046, Col: 3], zk.wpd
fire [Línea: 14348, Col: 5], zk.wpd
_docResize [Línea: 19618, Col: 4], zk.wpd
Hi Ricardo,
Thanks for updating the debug stacktrace. Unless it's triggered manually, docResize should be caused by the browser window resizing, or by the device changing orientation (portrait <> landscape) if it's a mobile or tablet.
docResize might also happen if the ZK app is running inside of an IFrame which is resized.
If you put a breakpoint inside of either zFlex.fixFlex or _docResize, you can check from where this was called. If you find it's called by _sizeHandler (above in the async stack), then it's likely triggered by the actual browser window. If that's the case, it would be interesting to check if the issue is browser-related (only on Chrome, IE, Firefox, etc)
If the resize event comes from another source, then it's a good lead.
In any case, from the stacktrace, it looks like a speed condition between a resize event and a component being removed from the page. You can prevent the issue altogether by checking if the component is attached before firing fixFlex.
<script><![CDATA[
zk.afterLoad("zk", function () {
var _xzFlex = {};
zk.override(zFlex, _xzFlex, {
fixFlex: function(wgt) {
if(wgt == null || wgt.$n() == null || wgt.$n().parentNode == null){
console.warn("skipped resize for widget: " + wgt);
return; //prevent default action
}
var result = _xzFlex.fixFlex.apply(this, arguments);
return result;
}
});
});
]]></script>
This should prevent the symptoms, since it will skip fixFlex for widgets that aren't attached to the page. Would still like to know the cause :)
regarding this script: you can deploy it in a single page with <script> tag, but it's be more efficient to deploy in lang-addon.xml if you need to have it active in every page of your application.
Hi MDuchemin, I have added a script tag to the window. Now the same trace appears but the stackTrace indicates that the source of the problem is somewhere else.
stacktrace:
[Subproceso principal]
zAu._doCmds [Línea: 20635, Col: 11], zk.wpd
afterResponse [Línea: 20235, Col: 3], zk.wpd
onResponseReady [Línea: 20232, Col: 3], zk.wpd
Exception stack trace:
"TypeError: No se puede obtener la propiedad 'innerHTML' de referencia nula o sin definir
at Anonymous function (https://url/zkau/web/a8976732/js/zk.wpd:12028:4)
at _calcMinWd (https://url/zkau/web/_zv2017011012/js/zul.mesh.wpd:114:6)
at _calcMinWds (https://url/zkau/web/_zv2017011012/js/zul.mesh.wpd:1217:4)
at updateMesh_ (https://url/zkau/web/_zv2017011012/js/zul.mesh.wpd:2080:5)
at setVisible (https://url/zkau/web/_zv2017011012/js/zul.mesh.wpd:2143:4)
at zk.Object.prototype.$supers (https://url/zkau/web/a8976732/js/zk.wpd:10802:4)
at setVisible (https://url/zkau/web/_zv2017011012/js/zul.grid.wpd:126:4)
at _set2 (https://url/zkau/web/a8976732/js/zk.wpd:10333:5)
at setter.func (https://url/zkau/web/a8976732/js/zk.wpd:15880:7)
at Anonymous function (https://url/zkau/web/a8976732/js/zk.wpd:15908:4)"
Do you think they are related or are stand-alone errors?
Thank you for your help.
Good news: not the same error, not the same stack. That suggest the first error is prevented by the snippet posted last time.
Bad new: new error. It is triggered by setVisible (most likely on grid.setVisible, or column.setVisible), and it fails to find the DOM node associated with one of the widgets or its parent. Since we saw in your last stacktrace that the column's parent either is null or not attached, it's likely that this error is caused by the same condition.
I still can't tell if the widget is detached but not cleaned-up, or if it's in an unexpected state (attached, but with a DOM node removed or something like that).
Is it possible to make a zkfiddle sample of the issue? I'd be helpful to run the page locally to have a look at the exact sequence of events causing the issue.
Asked: 2019-10-14 23:07:17 +0800
Seen: 51 times
Last updated: Nov 20 '19