Skip to content

Commit

Permalink
lpt.attachTrigger on runtime method add
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaeverywhere committed Jul 16, 2015
1 parent 05c5e6b commit 2482b92
Show file tree
Hide file tree
Showing 3 changed files with 15 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.2.10",
"version": "1.2.11",
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
"main": "test/testServer.js",
"repository": {
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ lp.updateSizes(); // recalculate pivot sizes
lp.changeBasicMDX("..."); // change mdx for LPT
lp.getActualMDX(); // returns currently displayed MDX
lp.getSelectedRows(); // returns array with selected rows indexes. First row have index 1.
lp.attachTrigger("contentRendered", function () { }); // attaches trigger during runtime
```

#### Caché DeepSee
Expand Down
13 changes: 13 additions & 0 deletions source/js/LightPivotTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,19 @@ LightPivotTable.prototype.getPivotProperty = function (path) {
return obj;
};

/**
* Attaches the trigger during the runtime.
* @param {string} triggerName
* @param {function} trigger
*/
LightPivotTable.prototype.attachTrigger = function (triggerName, trigger) {
if (typeof trigger !== "function") {
console.warn("LPT.addTrigger: pass the trigger as a second argument.");
return;
}
this.CONFIG.triggers[triggerName] = trigger;
};

/**
* Fill up to normal config structure to avoid additional checks and issues.
*
Expand Down

0 comments on commit 2482b92

Please sign in to comment.