Skip to content

Commit 6e5ec73

Browse files
isListing API function add
1 parent ba10464 commit 6e5ec73

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

package.json

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

readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ lp.getActualMDX(); // returns currently displayed MDX
9898
lp.getSelectedRows(); // returns array with selected rows indexes. First row have index 1.
9999
lp.attachTrigger("contentRendered", function (lptInstance) { }); // attaches trigger during runtime
100100
lp.setRowCount(5); // sets the number of rows to display
101+
console.log( lp.isListing() ); // returns true if current data display is listing
101102

102103
// Additional calls:
103104
lp.pivotView.getCellElement(x, y, considerHeaders); // returns cell element by given coordinates

source/js/DataController.js

-3
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,12 @@ DataController.prototype.getData = function () {
8888

8989
DataController.prototype.setData = function (data) {
9090

91-
var _ = this;
92-
9391
if (!this.isValidData(data)) {
9492
console.error("Invalid data to set.", data);
9593
return;
9694
}
9795

9896
this._dataStack[this._dataStack.length - 1].data = data;
99-
//this.data = data;
10097
this.setLeftHeaderColumnsNumber(data); // required in resetDimensionProps()
10198
this.pivotDataProcess(data);
10299
this.resetDimensionProps();

source/js/LightPivotTable.js

+9
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ LightPivotTable.prototype.getActualMDX = function () {
120120

121121
};
122122

123+
/**
124+
* Returns if current display is listing.
125+
*/
126+
LightPivotTable.prototype.isListing = function () {
127+
128+
return (this.dataController.getData().info || {}).leftHeaderColumnsNumber === 0;
129+
130+
};
131+
123132
/**
124133
* Return array with selected rows indexes.
125134
*/

0 commit comments

Comments
 (0)