|
58 | 58 | <td id="delete_button_container_<%- data.id %>" class="col-delete">
|
59 | 59 | <input type="hidden" class="delete-flag" name="option[delete][<%- data.id %>]" value="" />
|
60 | 60 | <?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
|
61 |
| - <button title="<?php echo __('Delete') ?>" type="button" |
| 61 | + <button id="delete_button_<%- data.id %>" title="<?php echo __('Delete') ?>" type="button" |
62 | 62 | class="action- scalable delete delete-option"
|
63 | 63 | >
|
64 | 64 | <span><?php echo __('Delete') ?></span>
|
@@ -100,7 +100,6 @@ require([
|
100 | 100 | if (isNewOption && !this.isReadOnly) {
|
101 | 101 | this.enableNewOptionDeleteButton(data.id);
|
102 | 102 | }
|
103 |
| - this.bindRemoveButtons(); |
104 | 103 | this.itemCount++;
|
105 | 104 | this.totalItems++;
|
106 | 105 | this.updateItemsCountField();
|
@@ -139,22 +138,16 @@ require([
|
139 | 138 | button.removeClassName('disabled');
|
140 | 139 | });
|
141 | 140 | },
|
142 |
| - bindRemoveButtons: function() { |
143 |
| - var buttons = $$('.delete-option'); |
144 |
| - for (var i = 0; i < buttons.length; i++) { |
145 |
| - if (!$(buttons[i]).binded) { |
146 |
| - $(buttons[i]).binded = true; |
147 |
| - Event.observe(buttons[i], 'click', this.remove.bind(this)); |
148 |
| - } |
149 |
| - } |
150 |
| - } |
151 | 141 | };
|
152 | 142 |
|
153 |
| - attributeOption.bindRemoveButtons(); |
154 |
| - |
155 | 143 | if ($('add_new_option_button')) {
|
156 | 144 | Event.observe('add_new_option_button', 'click', attributeOption.add.bind(attributeOption));
|
157 | 145 | }
|
| 146 | + |
| 147 | + $('manage-options-panel').on('click', '.delete-option', function(event, element) { |
| 148 | + attributeOption.remove(event); |
| 149 | + }); |
| 150 | + |
158 | 151 | <?php foreach ($block->getOptionValues() as $_value): ?>
|
159 | 152 | attributeOption.add(<?php echo $_value->toJson() ?>);
|
160 | 153 | <?php endforeach; ?>
|
|
0 commit comments