slickgrid
Advanced tools
Comparing version 2.4.24 to 2.4.25
@@ -135,2 +135,3 @@ /*** | ||
var $customMenu; | ||
var $header; | ||
var $list; | ||
@@ -155,2 +156,14 @@ var $button; | ||
// when a grid changes from a regular grid to a frozen grid, we need to destroy & recreate the grid menu | ||
// we do this change because the Grid Menu is on the left container on a regular grid but is on the right container on a frozen grid | ||
grid.onSetOptions.subscribe(function(e, args) { | ||
if (args && args.optionsBefore && args.optionsAfter) { | ||
var switchedFromRegularToFrozen = args.optionsBefore.frozenColumn >= 0 && args.optionsAfter.frozenColumn === -1; | ||
var switchedFromFrozenToRegular = args.optionsBefore.frozenColumn === -1 && args.optionsAfter.frozenColumn >= 0; | ||
if (switchedFromRegularToFrozen || switchedFromFrozenToRegular) { | ||
recreateGridMenu(); | ||
} | ||
} | ||
}); | ||
function init(grid) { | ||
@@ -170,3 +183,2 @@ _gridOptions = grid.getOptions(); | ||
var gridMenuWidth = (_options.gridMenu && _options.gridMenu.menuWidth) || _defaults.menuWidth; | ||
var $header; | ||
if (_gridOptions && _gridOptions.hasOwnProperty('frozenColumn') && _gridOptions.frozenColumn >= 0) { | ||
@@ -215,2 +227,3 @@ $header = $('.' + _gridUid + ' .slick-header-right'); | ||
/** Destroy the plugin by unsubscribing every events & also delete the menu DOM elements */ | ||
function destroy() { | ||
@@ -224,2 +237,8 @@ _self.onAfterMenuShow.unsubscribe(); | ||
_grid.onBeforeDestroy.unsubscribe(); | ||
_grid.onSetOptions.unsubscribe(); | ||
deleteMenu(); | ||
} | ||
/** Delete the menu DOM element but without unsubscribing any events */ | ||
function deleteMenu() { | ||
$(document.body).off("mousedown." + _gridUid, handleBodyMouseDown); | ||
@@ -229,2 +248,5 @@ $("div.slick-gridmenu." + _gridUid).hide(); | ||
$button.remove(); | ||
if ($header) { | ||
$header.attr('style', 'width: 100%'); // put back original width | ||
} | ||
} | ||
@@ -326,2 +348,8 @@ | ||
/** Delete and then Recreate the Grid Menu (for example when we switch from regular to a frozen grid) */ | ||
function recreateGridMenu() { | ||
deleteMenu(); | ||
init(_grid); | ||
} | ||
function showGridMenu(e) { | ||
@@ -610,2 +638,4 @@ e.preventDefault(); | ||
"destroy": destroy, | ||
"deleteMenu": deleteMenu, | ||
"recreateGridMenu": recreateGridMenu, | ||
"showGridMenu": showGridMenu, | ||
@@ -612,0 +642,0 @@ "setOptions": setOptions, |
{ | ||
"name": "slickgrid", | ||
"version": "2.4.24", | ||
"version": "2.4.25", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -37,3 +37,3 @@ "main": "slick.core.js", | ||
"devDependencies": { | ||
"cypress": "^4.6.0", | ||
"cypress": "^4.8.0", | ||
"eslint": "^7.0.0", | ||
@@ -40,0 +40,0 @@ "http-server": "^0.12.3" |
@@ -22,3 +22,4 @@ (function ($) { | ||
enableForHeaderCells: false, | ||
maxToolTipLength: null | ||
maxToolTipLength: null, | ||
replaceExisting: true | ||
}; | ||
@@ -53,11 +54,13 @@ | ||
var text; | ||
if ($node.innerWidth() < $node[0].scrollWidth) { | ||
text = $.trim($node.text()); | ||
if (options.maxToolTipLength && text.length > options.maxToolTipLength) { | ||
text = text.substr(0, options.maxToolTipLength - 3) + "..."; | ||
if (!$node.attr("title") || options.replaceExisting) { | ||
if ($node.innerWidth() < $node[0].scrollWidth) { | ||
text = $.trim($node.text()); | ||
if (options.maxToolTipLength && text.length > options.maxToolTipLength) { | ||
text = text.substr(0, options.maxToolTipLength - 3) + "..."; | ||
} | ||
} else { | ||
text = ""; | ||
} | ||
} else { | ||
text = ""; | ||
$node.attr("title", text); | ||
} | ||
$node.attr("title", text); | ||
} | ||
@@ -64,0 +67,0 @@ } |
@@ -37,3 +37,3 @@ /** | ||
// user could override the expandable icon logic from within the options or after instantiating the plugin | ||
if (typeof options.usabilityOverride === 'function') { | ||
if (options && typeof options.usabilityOverride === 'function') { | ||
usabilityOverride(options.usabilityOverride); | ||
@@ -40,0 +40,0 @@ } |
@@ -657,3 +657,3 @@ (function ($) { | ||
if(groups.length) { | ||
addTotals(groups); | ||
addTotals(groups, level); | ||
} | ||
@@ -660,0 +660,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4132726
137
96868