Cabcom Posted July 2, 2017 Posted July 2, 2017 Hi, Is there a possibility to reorder repeater fields (with Database Update) with the API from the frontend ? Just like in the backend by drag'n 'drop Thanks for any suggestions
Robin S Posted July 3, 2017 Posted July 3, 2017 Welcome @Cabcom, Sure it is possible, but not a simple task. You'd be looking at something like the following: Create elements (divs or whatever) in the front-end that represent your repeater items (probably using repeater item page ID as an identifier). Use some Javascript on the elements that supports drag-and-drop sorting - I'm sure there are a number of off-the-shelf solutions for this. When a submit button is clicked, submit an array of the the repeater item IDs in the current sort order to a ProcessWire page (using a form or AJAX). In the template for that page, get the submitted array and apply the sorting to the repeater field using the API. It might be easier to remove all items from the field and then add the items back in the array order than to try and adjust the sorting of the items already in the field. If you are up for the challenge I'm sure you'll find help here in the forums if you get stuck on a step. 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now