浏览代码

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');
         });
     }
 }