Skip to content

Commit

Permalink
[UI] Fix the database tooltip hidden problem (#19285)
Browse files Browse the repository at this point in the history
* Update dataTable.js

* add scrolling points

add scrolling points

* update a ui tests

update a ui tests
  • Loading branch information
Peter Zhang committed May 30, 2022
1 parent bd6b69c commit c0159b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions plugins/CoreHome/javascripts/dataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1585,8 +1585,10 @@ $.extend(DataTable.prototype, UIControl.prototype, {
tooltip.next().hover(function () {
var left = (-1 * tooltip.outerWidth() / 2) + th.width() / 2;
var top = -1 * tooltip.outerHeight();

var thPos = th.position();
var distance = tooltip.parent().offset().top;
var scroller = tooltip.closest('.dataTableScroller');

var thPosTop = 0;

if (thPos && thPos.top) {
Expand All @@ -1597,8 +1599,12 @@ $.extend(DataTable.prototype, UIControl.prototype, {
// headline
top = top + thPosTop;

if ($(window).scrollTop() >= distance - 100 || scroller.css('overflow-x')==='scroll') {
top = tooltip.parent().outerHeight()
}

if (!th.next().length) {
left = (-1 * tooltip.outerWidth()) + th.width() +
left = (-1 * tooltip.outerWidth()) + th.width() +
parseInt(th.css('padding-right'), 10);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/UI/specs/UIIntegration_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ describe("UIIntegrationTest", function () { // TODO: Rename to Piwik?
// manipulate the styles a bit, as it's otherwise not visible on screenshot
await page.evaluate(function () {
var style = document.createElement('style');
style.innerHTML = '.permadocs { display: block !important;z-index:150!important; } .dataTable thead{ z-index:150 !important; }';
style.innerHTML = '.permadocs { display: block !important;z-index:150!important;margin-top:0!important; } .dataTable thead{ z-index:150 !important; }';
$('body').append(style);

//add index not overlap others
Expand Down

0 comments on commit c0159b4

Please sign in to comment.