Skip to content

Commit 9218825

Browse files
v23entv23ent
authored andcommitted
Merge branch 'intersystems-ru/master'
2 parents b46c5a3 + 2482b92 commit 9218825

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

export/LightPivotTable-DeepSeePortlet.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<Class name="DeepSee.LightPivotTable">
1313
<Super>%DeepSee.Component.Portlet.abstractPortlet</Super>
14-
<TimeChanged>63700,68026.762239</TimeChanged>
14+
<TimeChanged>63749,65155.748273</TimeChanged>
1515
<TimeCreated>63515,61322.546099</TimeCreated>
1616

1717
<Parameter name="INCLUDEFILES">
@@ -151,6 +151,20 @@
151151
]]></Implementation>
152152
</Method>
153153

154+
<Method name="registerLPTOnCreateCallback">
155+
<Description>
156+
Call this method when widget is created to handle moment when pivot table will be created.
157+
If LPT has been created before, method fires given callback immidiately.</Description>
158+
<FormalSpec>callback</FormalSpec>
159+
<Language>javascript</Language>
160+
<ClientMethod>1</ClientMethod>
161+
<Implementation><![CDATA[
162+
if (typeof callback !== "function") return;
163+
if (this.LightPivotTable) callback(this.LightPivotTable);
164+
else this._registeredLPTOnCreateCallback = callback;
165+
]]></Implementation>
166+
</Method>
167+
154168
<Method name="InitLPT">
155169
<Language>javascript</Language>
156170
<ClientMethod>1</ClientMethod>
@@ -301,6 +315,7 @@
301315
}
302316
303317
_.LightPivotTable = new LightPivotTable(setup);
318+
if (this._registeredLPTOnCreateCallback) this._registeredLPTOnCreateCallback(_.LightPivotTable);
304319
305320
// hack to enable some change events
306321
setTimeout(function () { _._INITIALIZED = true; }, 800);

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.8",
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: 5 additions & 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
@@ -99,6 +100,10 @@ build/LightPivotTable.xml</code> into namespace you want. Make sure that MDX2JSO
99100
installed and configured. Also you may need to change the widget property "MDX2JSON source" to make
100101
it work with another MDX2JSON source.
101102

103+
You can obtain LPT instance from widget by calling widgetInstance.registerLPTOnCreateCallback method.
104+
This method takes one argument - anonymous function, which will be executed when LPT instance is created.
105+
The anonymous function takes one argument - LPT instance.
106+
102107
## Build
103108

104109
You need [NodeJS](http://nodejs.org/) platform to be installed in your system to perform any build

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)