-
Notifications
You must be signed in to change notification settings - Fork 894
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
[POC][WIP] add CrudField function to get all fields on page - crud.allFields()
#4962
base: main
Are you sure you want to change the base?
Conversation
crud.allFields()
crud.allFields()
What do you think @pxpm ... should we do this?! 🤷♂️ One thing that makes me say "yes" is that even us, in the demo, we have a place where we MANUALLY specify all fields in Monster. To then target them using the hide/show/disable/enable buttons in FieldMonsters. So... we did have the need for this... but didn't fix it by adding to the API. |
The inspection completed: No new issues |
We'd love to have this feature. thanks for working on it ! I kindly suggest a way to retrieve not all fields but an object with all field names and their values. |
Hey @realtebo I like this feature too. We may revive this soon 🙏 Regarding sending the form values, you can already serialize a form to array. We also have an helper that helps (who would have guessed? 🙃 ) on "arranging" that form data, that we use on the select2_ajax functionality: Line 58 in 9f494d6
So when you send the request to use that helper, just make sure you send your serialized form data inside the I've given you an example in Laravel-Backpack/community-forum#646 (comment) Cheers |
This function helps for php-side. I mean for js side. |
WHY
BEFORE - What was wrong? What was happening before this PR?
When working on Laravel-Backpack/community-forum#206 (comment) I realised
we have no way of getting ALL fields on page.
AFTER - What is happening after this PR?
We do, we have
crud.allFields()
which returns the same as if you passed an array with all the fields you want tocrud.fields()
HOW
How did you achieve that, in technical terms?
jQuery, but should be refactored to JS if we decide to do it.
Is it a breaking change?
Non-breaking.
How can we test the before & after?
Inside any CRUD Create/Update operation, you can do
crud.allFields()
to select all fields;crud.allFields().forEach(field => { field.hide(); });
to hide all fields in a form;