Skip to content
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

CMSAction - Removes Gridfield details on saving #19

Closed
mspacemedia opened this issue Apr 24, 2022 · 13 comments
Closed

CMSAction - Removes Gridfield details on saving #19

mspacemedia opened this issue Apr 24, 2022 · 13 comments

Comments

@mspacemedia
Copy link

mspacemedia commented Apr 24, 2022

This might be my implementation, but when I click an item in a gridfield and then the resultant CMSAction on that object the module removes the Gridfield status from the URL, this then means clicking next/prev or save and next do not work as normal.

->setShouldRefresh to true or false makes no difference either.

My code is in updateCMSActions on an extension:

$getLogo = CustomAction::create('doGetLogo', 'Get Logo');
$getLogo->setShouldRefresh(false);
$actions->push($getLogo);

@lekoala
Copy link
Owner

lekoala commented Apr 24, 2022

It might depend on what your action does ? I'm not an expert on gridfield state so maybe it's a matter of checking when the URL is updated incorrectly. I don't see how an Ajax request to an action should change anything

@mspacemedia
Copy link
Author

Me either @lekoala, all the action does it guzzle a logo from a URL and save a local copy. It then writes the dataobject to the database to store the ID of the newly 'minted' image in the Filesystem. I then tried with setShouldRefresh set to true and false and both have the same effect on the URL it strips out the GridField URL data…

I shall dig a bit deeper in XDebug

@mspacemedia
Copy link
Author

https://github.com/isobar-nz/silverstripe-persistentgridfield appears to fix the issue - to a degree…

@lekoala
Copy link
Owner

lekoala commented May 18, 2022

@mspacemedia actually just tried to test this, and i never have gridfield status in the url so prev/next (even the built in nav from silverstripe) always apply to the unfiltered list.
which version of silverstripe are you using?
this seems actually an issue for a while and not really specific to this module i believe
silverstripe/silverstripe-framework#3229

@mspacemedia
Copy link
Author

@lekoala I'm seeing this issue in the latest SS4 build from this in composer:

    "silverstripe/recipe-plugin": "^1.2",
    "silverstripe/recipe-cms": "~4.9.0@stable"

@lekoala
Copy link
Owner

lekoala commented Jun 17, 2022

I'm keeping this open but I don't plan to work on it until I have a reproduceable example. If anyone has the issue or finds a solution, a PR is welcome

@silverstripesk
Copy link

From SilverStripe 4.12 gridfield state is present in URL. Saving DataObject removes gridState from URL. Default SilverStripe implementation does not remove this from URL. Also Prev/Next buttons do not respect filter applied on gridfield (is present in URL on selected DataObject).

@lekoala
Copy link
Owner

lekoala commented Mar 28, 2023

@silverstripesk wow not sure how i missed that :)
fix is in progress, this is what i've made so far which work for save and close, save and prev/next
bfe61f9

@lekoala
Copy link
Owner

lekoala commented Mar 29, 2023

@silverstripesk @mspacemedia i've made quite a few grid state related updates on master, if you can give it a try and let me know how it goes ? ;-)
it might not be 100% perfect, but i do see a lot of improvements on my test project

@silverstripesk
Copy link

works on Prev/Next/Save+Close
doesn't work on Save+Prev/Save+Next

@lekoala
Copy link
Owner

lekoala commented May 10, 2023

@silverstripesk that's very odd, it seems to be working just fine for me (tested in modeladmin, on base grid and nested grids)
i've released a new version https://github.com/lekoala/silverstripe-cms-actions/releases/tag/1.3.13 can you make sure to test with it ?

@silverstripesk
Copy link

great, now work all buttons.

One visual issue: prev/next buttons are missing arrows
obrázok

@lekoala
Copy link
Owner

lekoala commented May 10, 2023

indeed, missed that one ;-)
i'm closing the issue, the css is fixed here
https://github.com/lekoala/silverstripe-cms-actions/releases/tag/1.3.14

@lekoala lekoala closed this as completed May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants