unclecheese / silverstripe-gridfield-betterbuttons

Adds new form actions and buttons to the GridField detail form
GNU General Public License v2.0
80 stars 88 forks source link

Console error in the CMS #173

Open silverstripe-elliot opened 6 years ago

silverstripe-elliot commented 6 years ago

When I install the module with 2.x-dev, I get the following error when I add a new action: Uncaught Error: cannot call methods on button prior to initialization; attempted to call method 'destroy'. The buttons appear (without styling) on the initial load, but when I refresh the CMS it will get stuck on the "Loading" screen.

If I comment out this line the console error is removed. I'm not sure what the implications of removing this line would be.

3Dgoo commented 6 years ago

I'm also having this issue. This error breaks viewing versioned dataobjects in the CMS for me.

groundnation commented 6 years ago

Me too - exact same problem as silverstripe-elliot

pixelsnap 2018-03-01 at 09 08 57

shaunjc commented 6 years ago

I'm also experiencing the same issue.

Commenting out the line suggested by silverstripe-elliot prevents the console error, as well as allows those pages to load when refreshed, but all the buttons are still styled incorrectly. I've since wrapped it in a try statement, but to no avail.

EDIT

I've since confirmed that DataObjects with the Extension Versioned and multiple stages are the only ones that seem affected. Those with just versioning appear to work fine for now.

private static $extensions = [
    Versioned::class . '.versioned', // Standard buttons shown - no apparent rollback functionality.
    Versioned::class,                // Buttons do not display correctly and issues publishing.
];

I'm unsure if my changes to the JS file are helping or not, but I've noticed the following click events:

danaenz commented 6 years ago

Can confirm I'm having the same issues @shaunjc is experiencing, though I extended as so:

private static $extensions = [
    Versioned::class . '("Stage","Live")'
];
shaunjc commented 6 years ago

I found the issue with the page redirecting to /SilverStripe/Forms/FormRequestHandler when you click publish. Created new Issue: https://github.com/unclecheese/silverstripe-gridfield-betterbuttons/issues/174 with description why and suggested fixes.