diff --git a/src/resources/js/WidgetController.js b/src/resources/js/WidgetController.js index fa90d13..1579e1d 100644 --- a/src/resources/js/WidgetController.js +++ b/src/resources/js/WidgetController.js @@ -144,14 +144,9 @@ CMS.controllers.add('widget.get.location', function () { $('.table tbody tr[data-parent-id="' + id + '"]').each(function () { var $select = $(this).find('select.widget-blocks'); - var $options = $select.data('blocks'); - - for (i in $options) { - var $option = $options[i]; - if ($option['id'] == block_name) { - $select.val($option['id']).trigger('change'); - } + if ($select.find('option[value=' + block_name + ']').length) { + $select.val(block_name).trigger('change'); } $(this).find('input.widget-position').val(position); @@ -251,4 +246,4 @@ function load_snippets(intervalID) { load_snippets(intervalID); }, 10000); }); -} \ No newline at end of file +}