elo80ka / django-dynamic-formset

A jQuery plugin that allows you dynamically add new forms to a rendered django formset.
675 stars 309 forks source link

Add option to either append or prepend delete button #202

Closed ridoo closed 4 months ago

ridoo commented 4 months ago

I would like to decide where to place the delete button. Currently, the delete button is always appended:

https://github.com/elo80ka/django-dynamic-formset/blob/38475fb944deb6a0fbcccf5b753adad0bba3261a/src/jquery.formset.js#L64-L75

An quick and dirty solution would be to add an option like prependDelete=True and handle it appropirately in the above code. Would it make sense to add even more flexibility here, or do you have some hints/tricks to overcome this limitation?

ridoo commented 4 months ago

I stumbled upon deleteContainerClass which leverages me exactly what I was asking for: Placing the delete button in the template where I want it to be. Great peace of code, thanks! Closing.