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

Feature request: User Supplied $addBtn.click Function #111

Closed tundebabzy closed 8 years ago

tundebabzy commented 8 years ago

In two different instances, I had problems with django-dynamic-formset not playing nice when used with other scripts. The main culprit is this line:

var row = $('.' + options.formCssClass + ':first').clone(true).get(0);

In one instance, I had to change the code to:

var row = $('.' + options.formCssClass + ':first').clone().get(0);

because I didn't need the events to be cloned. In another case, I had to change the code to add a line like:

$(row).find('input.flexselect').remove(); // remove input field that is to be automatically added by another script

Hence, I think it will be a nice idea to add an optional option which takes a function that should be wired to $addbtn to replace the default function when needed.

elo80ka commented 8 years ago

Hey @tundebabzy,

Do you mean have a function that runs before the new form is added, or allow users totally replace (and re-implement) the add-functionality? The former sounds more user-friendly than the latter...

tundebabzy commented 8 years ago

The latter is what I'm referring to. However, I just discovered that I downloaded 1.1. There's no point debating based on an old version so i'll just close this issue for now till I try the latest version and see if it's more malleable.