Skip to content

Commit c1b633b

Browse files
drilldown won't be performed if text selection was made
1 parent dd913f3 commit c1b633b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "LightPivotTable",
33
"author": "ZitRo",
4-
"version": "1.0.0-beta.20",
4+
"version": "1.0.0",
55
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
66
"main": "test/testServer.js",
77
"repository": {

source/js/PivotView.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,25 @@ PivotView.prototype._drillThroughClickHandler = function (event) {
301301

302302
};
303303

304+
/**
305+
* Get selected text if selection was made.
306+
* @returns {string}
307+
* @private
308+
*/
309+
PivotView.prototype._getSelectedText = function () {
310+
311+
var text = "";
312+
313+
if (typeof window.getSelection != "undefined") {
314+
text = window.getSelection().toString();
315+
} else if (typeof document.selection != "undefined" && document.selection.type == "Text") {
316+
text = document.selection.createRange().text;
317+
}
318+
319+
return text;
320+
321+
};
322+
304323
/**
305324
* @param {object} cell
306325
* @param {number} x
@@ -315,6 +334,8 @@ PivotView.prototype._cellClickHandler = function (cell, x, y, event, drillThroug
315334
ATTACH_TOTALS = this.controller.CONFIG["showSummary"]
316335
&& this.controller.CONFIG["attachTotals"] ? 1 : 0;
317336

337+
if (this._getSelectedText()) return; // exit if text in cell was selected
338+
318339
try {
319340
f1 = data.rawData[y][data.info.leftHeaderColumnsNumber - 1].source.path;
320341
f2 = data.rawData[data.info.topHeaderRowsNumber - 1 - ATTACH_TOTALS][x].source.path;

0 commit comments

Comments
 (0)