Skip to content

Commit b7af362

Browse files
committed
fix nested select when used inside a nested form
1 parent 4e26cc6 commit b7af362

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/assets/javascripts/activeadmin_addons/inputs/nested-select.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ var initializer = function() {
151151

152152
if (!!parent) {
153153
var parentSelectorId = '#' + model + '_' + parent;
154+
if (!$(parentSelectorId).length) {
155+
parentSelectorId = $(container).find('*[id*=' + parent + ']')[0];
156+
}
154157
var parentSelector = $(parentSelectorId)[0];
155158

156159
$(parentSelector).on('select2:select', setParentValue);

0 commit comments

Comments
 (0)