primefaces-extensions / primefaces-extensions.github.com

Organization repo, only for homepage, wiki and issue tracker
https://primefaces-extensions.github.io/
70 stars 22 forks source link

Sheet: issue after <f:ajax render="@all"/> #792

Closed eduarddrenth closed 4 years ago

eduarddrenth commented 4 years ago

pf 801 extensions 8.0

The following javascript problem occurs after render @all:

sheet.js.xhtml?ln=primefaces-extensions&v=8.0:348
Uncaught Error: The "destroy" method cannot be called because this Handsontable instance has been destroyed
    at e.default.destroy (sheet.js.xhtml?ln=primefaces-extensions&v=8.0:348)
    at c.refresh (sheet.js.xhtml?ln=primefaces-extensions&v=8.0:2090)
    at c.e.<computed> [as refresh] (core.js.xhtml:22)
    at Object.createWidget (core.js.xhtml:16)
    at Object.cw (core.js.xhtml:16)
    at <anonymous>:1:12
    at b (jquery.js.xhtml:2)
    at Ie (jquery.js.xhtml:2)
    at k.fn.init.replaceWith (jquery.js.xhtml:2)
    at Object.updateElement (core.js.xhtml:18)

workaround: <p:ajax update="...." onsuccess="location.reload()"/>

perhaps not a problem in extensions 8.0.1 anymore, did not test yet

melloware commented 4 years ago

Try 8.0.2. Had a bug in 8.0.1

melloware commented 4 years ago

PFE 8.0.2 that is. And render @all should ever be used. You may as well not use Ajax and just do a full page refresh rather than use @all

eduarddrenth commented 4 years ago

just tried 8.0.2, same issue. I'll do a refresh, prefer render @all though because it gives a less jerkey effect.

trace in 8.0.2:

Error: The "destroy" method cannot be called because this Handsontable instance has been destroyed sheet.js:348:318
    Ha https://localhost:8181/oat/faces/javax.faces.resource/sheet/sheet.js?ln=primefaces-extensions&v=8.0.2:348
    refresh https://localhost:8181/oat/faces/javax.faces.resource/sheet/sheet.js?ln=primefaces-extensions&v=8.0.2:2090
    Class.extend/e[d]</< https://localhost:8181/oat/faces/javax.faces.resource/core.js?ln=primefaces&v=8.0.1:22
    createWidget https://localhost:8181/oat/faces/javax.faces.resource/core.js?ln=primefaces&v=8.0.1:16
    cw https://localhost:8181/oat/faces/javax.faces.resource/core.js?ln=primefaces&v=8.0.1:16
    <anonymous> https://localhost:8181/oat/ line 2 > scriptElement:1
    jQuery 3
    updateElement https://localhost:8181/oat/faces/javax.faces.resource/core.js?ln=primefaces&v=8.0.1:18
    doUpdate https://localhost:8181/oat/faces/javax.faces.resource/core.js?ln=primefaces&v=8.0.1:18
    handle https://localhost:8181/oat/faces/javax.faces.resource/core.js?ln=primefaces&v=8.0.1:18
    v https://localhost:8181/oat/faces/javax.faces.resource/core.js?ln=primefaces&v=8.0.1:18
    jQuery 4
        c
        fireWith
        l
        o
melloware commented 4 years ago

Ok I will look into it. I added a method to clean up the sheet in 8.0. So that is probably the issue. I know how to fix it.

melloware commented 4 years ago

Can you try this JS snippet.

PrimeFaces.widget.ExtSheet.prototype.refresh = function(cfg) {
    // clean up HT memory
    if (this.ht) {
        this.ht.destroy();
        this.ht = null;
    }

    PrimeFaces.widget.BaseWidget.prototype.refresh.call(this, cfg);
};
eduarddrenth commented 4 years ago

trying....

eduarddrenth commented 4 years ago

That works, tested with 8.0.2. Error gone and sheet keeps working

I do have another console error that might not be related:

XML Parsing Error: undefined entity
Location: https://localhost:8181/oat/
Line Number 6, Column 1981:
melloware commented 4 years ago

XML parsing error does not look like its from PFE but let me know if you figure it out.

melloware commented 4 years ago

Fixed with commit: https://github.com/primefaces-extensions/core/commit/e6e03cc9ba8fefc68687dba71dc08abae532d2d7

eduarddrenth commented 4 years ago

thnx