-
Notifications
You must be signed in to change notification settings - Fork 824
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
ENH Restore gridfield state from get vars (POC) #10331
ENH Restore gridfield state from get vars (POC) #10331
Conversation
Hi @GuySartorelli , Are you planning to continue work on this task? Or do you want me to finish it? |
@sabina-talipova I'm not going to take this any further at this stage. I think we need to take a step back and look at how the state for gridfield is being managed more generally - as mentioned in my last comment there are quite a few issues with gridfield state which point to a deeper problem than this PR is equipped to resolve. |
eca30d7
to
f5197d5
Compare
This doesn't seem to work at all for relations in a gridfield on a page. e.g. try adding some relations to the "has many" or "many many" tabs in the "GridFieldTestPage" created by framework test. |
There's no code in here or in the companion admin PR to actually set the gridfield state to the URL when you perform some action (i.e. paginate or filter) - so the state is only appended to the URL for the The following ACs from the issue are therefore not met:
Interestingly there's no AC for the breadcrumb back button, but there probably should be. |
To keep State in URL after user click on search or sort fields, I had to make changes in GridField.js. All this changes in other PR: silverstripe/silverstripe-admin#1322 |
f5197d5
to
71bf390
Compare
93ff035
to
8deecfa
Compare
083f603
to
815db06
Compare
815db06
to
f74b472
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In GridFieldDetailForm_ItemRequest::getBackLink()
change the return
statement to this:
return $this->gridField->addOtherGridfieldStateToURL($backlink);
That way we don't have to do that in LeftAndMain
or CMSMain
etc.
f74b472
to
291ce3e
Compare
There's a failing unit test - other than that it looks good. |
291ce3e
to
7a9bc7f
Compare
@GuySartorelli, actions failed on unrelated to my changes test cases. Should I fix them? |
No, you can ignore that for this PR. It should be fixed separately. It looks like it was caused by a bad merge up from CI PRs, so Steve or I will look at it as part of the CI migration work |
Failed unit test is unrelated. |
I can't click "approve" since I originally opened this PR - so consider this message to be approval. |
The
GridFieldDetailForm
's item edit form adds the current gridfield state to the URL of the CMS breadcrumbs back button (not the browser back button).This PR pulls that state back into the
GridField
, so that when a user clicks back they retain the pagination and filter options they had set.Parent Issue
Why this is draftThe
GridField
is a complicated beast, and apparently there are a few issues related to this one which ideally should be addressed in tandem. Also, trying to resolve this is taking a lot longer than I expected, so I'm parking this for now.Note that this PR is not complete - for this functionality to be reliable we would need to make the following additional changes:
GridFieldViewButton
's URLGridFieldEditButton
doesn't include the state and decide if it should do soGridField.js
in theonmatch
event to make the search filter visible if the state indicates that the field has been filteredwindow.history.replaceState()
in admin javascript to add the gridfield state to the current history when the state changes (i.e. when paginating or filtering a gridfield)Related PR