Skip to content

Commit

Permalink
dropdown & airdatepicker (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvictor committed Nov 8, 2019
1 parent 4e71c62 commit 7139cf5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions inst/assets/sw-dropdown/sw-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,17 @@ function swDrop(

// Close on click outside dropdown
$("html").on("click", function(e) {
//console.log($(e.target).is("html"));
//console.log($(e.target).parents().end().attr('class').indexOf("datepicker"));
//console.log( $(e.target) );
var parentClass = $(e.target).parents().end().attr('class');
if (typeof parentClass == "undefined") {
parentClass = $(e.target).parents().attr('class');
}
if (typeof parentClass == "undefined") {
parentClass = "";
}
if (
//$(e.target).is("html") |
!$("#" + swDropdownId).is(e.target) &&
$("#" + swDropdownId).has(e.target).length === 0 &&
$("#" + swDropdownId).find(e.target).length === 0 &&
Expand All @@ -86,7 +94,10 @@ function swDrop(
$(e.target).prop("tagName") === "A" &&
RegExp("paginate_button").test($(e.target).attr("class")) === true
) && // hack for DT
$(e.target).is("html") | ($(e.target, ".datepicker").length !== 1) &&
//$(e.target).parents(".datepicker").length === 0 &&
(
parentClass.indexOf("datepicker") < 0
) &&
!(
$(e.target)
.parent()
Expand Down

0 comments on commit 7139cf5

Please sign in to comment.