event 'formset:added' and 'formset:removed' not triggering in javascript admin customisation for CompactInline
Using CompactInline, when trying to bind a listener to the 'formset:added' and 'formset:removed' as per the documentation in https://docs.djangoproject.com/en/1.11/ref/contrib/admin/javascript/, the callback function is never executed. Having a look around at compact-inline.js I realized that the event itself is never triggered. Adding the trigger in the file and rebuilding with gulp does not seem to work either.
How should I aproach this??
What are you trying about it? Maybe is because django-jet don't use the django admin scripts.
I just needed to attach a handler every time a new inline form is added to the admin to make some calculations on the inputs in the inline. Is there another event which is triggered when I add a new inline in CompactInline?
I don't know.
Hi, Having the same problem when add any inline.
@dmnunez1993 did you solve it?
I think I find the problem, jet is doing this: $('.inline-group').on('inline-group-row:added', function(e, $inlineItem) { $inlineItem.find('.form-row').each(function() { self.initLinksForRow($(this)); }); });
In django 2 I supose the right is this: $(document).on('formset:added', function(event, $row, formsetName) { if (formsetName == 'author_set') { // Do something } }); https://docs.djangoproject.com/en/2.0/ref/contrib/admin/javascript/
I fix in my project rewrite some codes, but the better way is fix onde library.
@evandroo, which library?
@dmnunez1993 did you solve it?
I ended up using the default stacked inline with custom styling! Maybe if I find some time during the week I can have a look at the issue and send a PR, but I am not so sure. Do you guys have some sort of contributing guidelines?
@f1nality that is a question for you.
@SalahAdDin, sorry man, I dont undestand. I talking about django-jet, when you try add inlines,
On django-jet, i got it, but it @f1nality depends.
+1