Skip to content
This repository was archived by the owner on Dec 14, 2021. It is now read-only.

Commit 4a0db43

Browse files
Merge pull request #24 from mendix/fix/timeout
Fixing timeout to find elements
2 parents 4369ffc + 2753220 commit 4a0db43

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "BootstrapTooltip",
3-
"version": "3.2.1",
3+
"version": "3.2.2",
44
"description": "This widget adds a tooltip to an user defined field, containing for example help text or extra information.",
55
"license": "Apache-2.0",
66
"author": "Mendix Technology B.V.",

src/BootstrapTooltip.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ export default declare("BootstrapTooltip.widget.BootstrapTooltip", [_WidgetBase,
4646
// Find element by classname in the same container (DOM level) as widget
4747
var $targetElement = $(this.domNode).siblings("." + this.tooltipClassName);
4848

49-
// No element found on same level, try to find target element on page
49+
// No element found on same level, try to find target element on same parent
50+
if ($targetElement.length === 0) {
51+
$targetElement = $(this.domNode.parentNode).find("." + this.tooltipClassName);
52+
}
53+
54+
// No element found on same level, try to find target element on same page
5055
if ($targetElement.length === 0) {
5156
$targetElement = $("." + this.tooltipClassName);
5257
}

src/BootstrapTooltipContext.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default declare("BootstrapTooltip.widget.BootstrapTooltipContext", [_boot
1414
var guid = obj ? obj.getGuid() : null;
1515
this._execMf(this.tooltipMessageMicroflow, guid, message => {
1616
this._tooltipText = message;
17-
this._initializeTooltip(callback);
17+
setTimeout(() => this._initializeTooltip(callback), 10);
1818
});
1919
return;
2020
}
@@ -27,7 +27,7 @@ export default declare("BootstrapTooltip.widget.BootstrapTooltipContext", [_boot
2727
}
2828
}
2929

30-
this._initializeTooltip(callback);
30+
setTimeout(() => this._initializeTooltip(callback), 10);
3131
},
3232

3333
_resetSubscriptions: function() {

0 commit comments

Comments
 (0)