|
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,7 @@ require([
|
100 | 100 | if (isNewOption && !this.isReadOnly) {
|
101 | 101 | this.enableNewOptionDeleteButton(data.id);
|
102 | 102 | }
|
103 |
| - this.bindRemoveButtons(); |
| 103 | + this.bindRemoveButton(data.id); |
104 | 104 | this.itemCount++;
|
105 | 105 | this.totalItems++;
|
106 | 106 | this.updateItemsCountField();
|
@@ -139,19 +139,11 @@ require([
|
139 | 139 | button.removeClassName('disabled');
|
140 | 140 | });
|
141 | 141 | },
|
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 |
| - } |
| 142 | + bindRemoveButton: function(id) { |
| 143 | + $('delete_button_' + id).observe('click', this.remove.bind(this)); |
150 | 144 | }
|
151 | 145 | };
|
152 | 146 |
|
153 |
| - attributeOption.bindRemoveButtons(); |
154 |
| - |
155 | 147 | if ($('add_new_option_button')) {
|
156 | 148 | Event.observe('add_new_option_button', 'click', attributeOption.add.bind(attributeOption));
|
157 | 149 | }
|
|
0 commit comments