Skip to content

Commit 13c2aa7

Browse files
Show rows number in listing option (enabled by default)
1 parent e52f4b2 commit 13c2aa7

File tree

5 files changed

+46
-3
lines changed

5 files changed

+46
-3
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.4.4",
4+
"version": "1.4.5",
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
@@ -77,6 +77,7 @@ var setup = { // Object that contain settings. Properties in brackets can be mis
7777
[ , enableSearch: true ] // enables search panel in listing (default: true)
7878
[ , showRowNumbers: true ] // show the row number in first column
7979
[ , enableListingSelect: true ] // enable listing selection, true by default
80+
[ , showListingRowsNumber: true ] // show rows number in listing and tables if paginated
8081
},
8182
lp = new LightPivotTable(setup);
8283

source/css/LightPivot.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,32 @@
5555
cursor: pointer;
5656
}
5757

58+
.lpt-bottomInfo {
59+
float: left;
60+
padding: 0 2px 0 2px;
61+
}
62+
63+
.lpt-icon-rows {
64+
position: relative;
65+
display: inline-block;
66+
width: 10px;
67+
height: 6px;
68+
border-top: 2px solid black;
69+
border-bottom: 2px solid black;
70+
vertical-align: middle;
71+
margin: 2px;
72+
}
73+
74+
.lpt-icon-rows:before {
75+
position: absolute;
76+
width: 100%;
77+
display: block;
78+
content: "";
79+
height: 0;
80+
top: 2px;
81+
border-bottom: 2px solid black;
82+
}
83+
5884
.lpt .lpt-tableBlock tr:hover td {
5985
box-shadow: inset 0 0 30px #fff5b9;
6086
}

source/js/LightPivotTable.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@ LightPivotTable.prototype.normalizeConfiguration = function (config) {
328328
if (typeof config["enableSearch"] === "undefined") config.enableSearch = true;
329329
if (typeof config["stretchColumns"] === "undefined") config.stretchColumns = true;
330330
if (typeof config["enableListingSelect"] === "undefined") config.enableListingSelect = true;
331+
if (typeof config["showListingRowsNumber"] === "undefined")
332+
config.showListingRowsNumber = true;
331333
if (!config["triggers"]) config.triggers = {};
332334
if (!config["dataSource"]) config.dataSource = {};
333335
};

source/js/PivotView.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,10 @@ PivotView.prototype.renderRawData = function (data) {
937937
mainTable = document.createElement("table"),
938938
mainTBody = document.createElement("tbody"),
939939

940-
pageSwitcher = this.pagination.on ? document.createElement("div") : null,
941-
pageNumbers = this.pagination.on ? [] : null,
940+
showBottomBar = this.pagination.on
941+
|| (LISTING && this.controller.CONFIG["showListingRowsNumber"]),
942+
pageSwitcher = showBottomBar ? document.createElement("div") : null,
943+
pageNumbers = showBottomBar ? [] : null,
942944
pageSwitcherContainer = pageSwitcher ? document.createElement("div") : null,
943945

944946
searchBlock = SEARCH_ENABLED ? document.createElement("div") : null,
@@ -1363,6 +1365,18 @@ PivotView.prototype.renderRawData = function (data) {
13631365
return pagesArr;
13641366

13651367
})(this.pagination.page + 1, this.pagination.pages);
1368+
if (this.controller.CONFIG.showListingRowsNumber) {
1369+
td = document.createElement("div");
1370+
tr = document.createElement("span");
1371+
tr.className = "lpt-icon-rows";
1372+
td.className = "lpt-bottomInfo";
1373+
td.appendChild(tr);
1374+
tr = document.createElement("span");
1375+
tr.textContent = data["rawData"].length - (data["info"].topHeaderRowsNumber || 0)
1376+
- (data["info"].SUMMARY_SHOWN ? 1 : 0);
1377+
td.appendChild(tr);
1378+
pageSwitcherContainer.appendChild(td);
1379+
}
13661380
for (i in pageNumbers) {
13671381
i = parseInt(i);
13681382
td = document.createElement("span");

0 commit comments

Comments
 (0)