Skip to content

Commit 2482b92

Browse files
lpt.attachTrigger on runtime method add
1 parent 05c5e6b commit 2482b92

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-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.2.10",
4+
"version": "1.2.11",
55
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
66
"main": "test/testServer.js",
77
"repository": {

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ lp.updateSizes(); // recalculate pivot sizes
9090
lp.changeBasicMDX("..."); // change mdx for LPT
9191
lp.getActualMDX(); // returns currently displayed MDX
9292
lp.getSelectedRows(); // returns array with selected rows indexes. First row have index 1.
93+
lp.attachTrigger("contentRendered", function () { }); // attaches trigger during runtime
9394
```
9495

9596
#### Caché DeepSee

source/js/LightPivotTable.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,19 @@ LightPivotTable.prototype.getPivotProperty = function (path) {
304304
return obj;
305305
};
306306

307+
/**
308+
* Attaches the trigger during the runtime.
309+
* @param {string} triggerName
310+
* @param {function} trigger
311+
*/
312+
LightPivotTable.prototype.attachTrigger = function (triggerName, trigger) {
313+
if (typeof trigger !== "function") {
314+
console.warn("LPT.addTrigger: pass the trigger as a second argument.");
315+
return;
316+
}
317+
this.CONFIG.triggers[triggerName] = trigger;
318+
};
319+
307320
/**
308321
* Fill up to normal config structure to avoid additional checks and issues.
309322
*

0 commit comments

Comments
 (0)