Преглед на файлове

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 години
родител
ревизия
b47ec8ed1d
променени са 1 файла, в които са добавени 4 реда и са изтрити 0 реда
  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');
         });
     }
 }