Skip to content

Commit

Permalink
drilldown won't be performed if text selection was made
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed May 24, 2015
1 parent dd913f3 commit c1b633b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "LightPivotTable",
"author": "ZitRo",
"version": "1.0.0-beta.20",
"version": "1.0.0",
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
"main": "test/testServer.js",
"repository": {
Expand Down
21 changes: 21 additions & 0 deletions source/js/PivotView.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,25 @@ PivotView.prototype._drillThroughClickHandler = function (event) {

};

/**
* Get selected text if selection was made.
* @returns {string}
* @private
*/
PivotView.prototype._getSelectedText = function () {

var text = "";

if (typeof window.getSelection != "undefined") {
text = window.getSelection().toString();
} else if (typeof document.selection != "undefined" && document.selection.type == "Text") {
text = document.selection.createRange().text;
}

return text;

};

/**
* @param {object} cell
* @param {number} x
Expand All @@ -315,6 +334,8 @@ PivotView.prototype._cellClickHandler = function (cell, x, y, event, drillThroug
ATTACH_TOTALS = this.controller.CONFIG["showSummary"]
&& this.controller.CONFIG["attachTotals"] ? 1 : 0;

if (this._getSelectedText()) return; // exit if text in cell was selected

try {
f1 = data.rawData[y][data.info.leftHeaderColumnsNumber - 1].source.path;
f2 = data.rawData[data.info.topHeaderRowsNumber - 1 - ATTACH_TOTALS][x].source.path;
Expand Down

0 comments on commit c1b633b

Please sign in to comment.