diff --git a/src/widgets/combo/InternalObjectCombo.php b/src/widgets/combo/InternalObjectCombo.php index 8b6efe55..f31fa904 100644 --- a/src/widgets/combo/InternalObjectCombo.php +++ b/src/widgets/combo/InternalObjectCombo.php @@ -164,11 +164,19 @@ private function registerSpecialAssets(): void $('#' + objectInputId).find('option').remove().end().val(null).trigger('change'); }); } + }, + deleteItem: function (widgetOptions, e, elem) { + if (widgetOptions.widgetContainer === 'charges_dynamicform_wrapper' && widgetOptions.min > 0) { + widgetOptions.min -= 1; + } + originalDynamicForm('deleteItem', widgetOptions, e, elem); } }; $.fn.yiiDynamicForm = function(method) { if (method === 'addItem') { return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 )); + } else if (method === 'deleteItem') { + return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 )); } originalDynamicForm.apply(this, arguments); }