Browse Source

Added two custom events to enable additional js to be executed after the field has been added/removed to the DOM(eg: adding a calendar picker to a just inserted date widget).

Claudio Beatrice 13 years ago
parent
commit
b47ec8ed1d
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Resources/public/base.js

+ 4 - 0
Resources/public/base.js

@@ -157,12 +157,16 @@ var Admin = {
             var proto = container.attr('data-prototype');
             proto = proto.replace(/\$\$name\$\$/g, container.children().length);
             jQuery(proto).insertBefore(jQuery(this).parent());
+            
+            jQuery(this).trigger('sonata-collection-item-added');
         });
 
         jQuery(subject).on('click', '.sonata-collection-delete', function(event) {
             Admin.stopEvent(event);
 
             jQuery(this).closest('.sonata-collection-row').remove();
+            
+            jQuery(this).trigger('sonata-collection-item-deleted');
         });
     }
 }