From 95e9e1a8a9aefb422f2701451c2994dd9a844880 Mon Sep 17 00:00:00 2001 From: Martin Melcher Date: Thu, 13 Oct 2016 11:32:21 +0200 Subject: [PATCH 1/2] Added an 'uninitialized' class for new instances --- InputfieldMapMarker.module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InputfieldMapMarker.module b/InputfieldMapMarker.module index a0da886..2b4ac24 100644 --- a/InputfieldMapMarker.module +++ b/InputfieldMapMarker.module @@ -156,7 +156,7 @@ class InputfieldMapMarker extends Inputfield { _OUT; - $out .= "
Date: Thu, 13 Oct 2016 11:37:24 +0200 Subject: [PATCH 2/2] Periodically check for AJAX-loaded Inputfields and init() them --- InputfieldMapMarker.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/InputfieldMapMarker.js b/InputfieldMapMarker.js index d0724d3..e08087f 100644 --- a/InputfieldMapMarker.js +++ b/InputfieldMapMarker.js @@ -123,8 +123,13 @@ var InputfieldMapMarker = { }; $(document).ready(function() { - $(".InputfieldMapMarkerMap").each(function() { - var $t = $(this); - InputfieldMapMarker.init($t.attr('id'), $t.attr('data-lat'), $t.attr('data-lng'), $t.attr('data-zoom'), $t.attr('data-type')); - }); + // Inputfields that are loaded by AJAX (e.g. in a collapsed repeater) might not exist yet on document.ready + // Periodically check for new InputfieldMapMarkerMaps and init them + window.setInterval( function initMapMarkersDelayed() { + $(".InputfieldMapMarkerMap.uninitialized").each(function() { + var $t = $(this); + $t.removeClass('uninitialized'); + InputfieldMapMarker.init($t.attr('id'), $t.attr('data-lat'), $t.attr('data-lng'), $t.attr('data-zoom'), $t.attr('data-type')); + }); + }, 1000); });