Skip to content

Commit e6fc4b8

Browse files
listing search, fixed IE/FF header columns, style fixes
1 parent f6a9959 commit e6fc4b8

8 files changed

+295
-43
lines changed

example/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
//, listingColumnMinWidth: 200 // minimal width of column in listing
120120
//, maxHeaderWidth: 100 // maximum width of header
121121
//, columnResizing: true // make columns resizable (default: true)
122+
//, enableSearch: false // enables search panel in listing
122123
};
123124

124125
if (req.DrillDownExpression) { // set custom DrillDown on variant 10

export/LightPivotTable-DeepSeePortlet.xml

+8-2
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>63578,68626.779569</TimeChanged>
14+
<TimeChanged>63579,79833.277338</TimeChanged>
1515
<TimeCreated>63515,61322.546099</TimeCreated>
1616

1717
<Parameter name="INCLUDEFILES">
@@ -50,6 +50,10 @@
5050
<Type>%Boolean</Type>
5151
</Property>
5252

53+
<Property name="EnableSearch">
54+
<Type>%Boolean</Type>
55+
</Property>
56+
5357
<Method name="%OnGetPortletName">
5458
<ClassMethod>1</ClassMethod>
5559
<ReturnType>%String</ReturnType>
@@ -79,6 +83,7 @@
7983
set pInfo($I(pInfo)) = $LB("ListingColumnMinWidth", 0, "%Integer", $$$Text("Min cell width for listing", "%DeepSee"), "Minimal column width in listing")
8084
set pInfo($I(pInfo)) = $LB("MaxHeaderWidth", 0, "%Integer", $$$Text("Max column width", "%DeepSee"), "Maximal column width for headers")
8185
set pInfo($I(pInfo)) = $LB("ColumnResizing", 1, "%Boolean", $$$Text("Column resizing", "%DeepSee"), "Allow resizing columns with cursor")
86+
set pInfo($I(pInfo)) = $LB("EnableSearch", 1, "%Boolean", $$$Text("Enable listing search", "%DeepSee"), "Show search tools in listing mode")
8287
8388
quit $$$OK
8489
]]></Implementation>
@@ -254,6 +259,7 @@
254259
setup["showSummary"] = !!parseInt(container.getAttribute("show-summary"));
255260
setup["attachTotals"] = !!parseInt(container.getAttribute("fixTotals"));
256261
setup["columnResizing"] = !!parseInt(container.getAttribute("columnResizing"));
262+
setup["enableSearch"] = !!parseInt(container.getAttribute("enableSearch"));
257263
if (parseInt(container.getAttribute("pagination"))) {
258264
setup["pagination"] = parseInt(container.getAttribute("pagination"))
259265
}
@@ -388,7 +394,7 @@
388394
}
389395
390396
&html<
391-
<div columnResizing="#(..ColumnResizing)#" session="#(%session.CSPSessionCookie)#" maxHeaderWidth="#(..MaxHeaderWidth)#" listingColumnMinWidth="#(..ListingColumnMinWidth)#" fixTotals="#(..FixTotals)#" pagination="#(..Pagination)#" export-csv="#(..ExportCSV)#" data-source="#(..DataSource)#" show-summary="#(..ShowSummary)#" class="lpt-container" style="position: absolute; left: 0; bottom: 0; width: 100%; height: 100%;">
397+
<div enableSearch="#(..EnableSearch)#" columnResizing="#(..ColumnResizing)#" session="#(%session.CSPSessionCookie)#" maxHeaderWidth="#(..MaxHeaderWidth)#" listingColumnMinWidth="#(..ListingColumnMinWidth)#" fixTotals="#(..FixTotals)#" pagination="#(..Pagination)#" export-csv="#(..ExportCSV)#" data-source="#(..DataSource)#" show-summary="#(..ShowSummary)#" class="lpt-container" style="position: absolute; left: 0; bottom: 0; width: 100%; height: 100%;">
392398
393399
</div>
394400
>

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.0.0-beta.7",
4+
"version": "1.0.0-beta.8",
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
@@ -66,6 +66,7 @@ var setup = { // Object that contain settings. Any setting may be missed.
6666
[ , listingColumnMinWidth: 200 ] // minimal width of column in listing
6767
[ , maxHeaderWidth: 100 ] // maximum width of header
6868
[ , columnResizing: true ] // make columns resizable (default: true)
69+
[ , enableSearch: true ] // enables search panel in listing (default: true)
6970
},
7071
lp = new LightPivotTable(setup);
7172

source/css/LightPivot.css

+99-10
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@
173173

174174
.lpt .lpt-pageSwitcher {
175175
position: absolute;
176-
display: table;
177176
box-sizing: border-box;
178177
bottom: 0;
179178
width: 100%;
@@ -185,8 +184,6 @@
185184

186185
.lpt .lpt-pageSwitcher > div {
187186
position: relative;
188-
display: table-cell;
189-
vertical-align: middle;
190187
height: 100%;
191188
text-align: center;
192189
}
@@ -368,17 +365,109 @@
368365
padding: 0 !important;
369366
}
370367

368+
.lpt-searchBlock {
369+
position: absolute;
370+
box-sizing: border-box;
371+
overflow: hidden;
372+
bottom: 20px;
373+
width: 100%;
374+
height: 20px;
375+
font-size: 14px;
376+
border: 1px solid rgb(208, 208, 208);
377+
background: #F0F0F0;
378+
}
379+
380+
.lpt-searchSelectOuter {
381+
position: relative;
382+
display: inline-block;
383+
width: 150px;
384+
margin: 1px 0 0 5px;
385+
overflow: hidden;
386+
vertical-align: top;
387+
background: #F0F0F0;
388+
border: 1px solid #D0D0D0;
389+
border-top: none;
390+
border-bottom: none;
391+
border-radius: 10px;
392+
}
393+
394+
.lpt-searchSelectOuter:after {
395+
content: "\25bc";
396+
position: absolute;
397+
top: 0;
398+
right: 5px;
399+
color: gray;
400+
}
401+
402+
.lpt-searchSelectOuter select {
403+
font-size: 13px;
404+
padding: 0 0 0 2px;
405+
width: 170px;
406+
vertical-align: top;
407+
height: 17px;
408+
max-height: 20px;
409+
background: transparent;
410+
outline: medium none;
411+
border: 0;
412+
cursor: pointer;
413+
}
414+
415+
/* relative positioning is incorrect here */
371416
.lpt-resizableColumn {
417+
418+
}
419+
420+
.lpt-searchIcon {
372421
position: relative;
422+
display: inline-block;
423+
vertical-align: top;
424+
box-sizing: border-box;
425+
margin: 1px 0 0 1px;
426+
width: 17px;
427+
height: 17px;
428+
border-radius: 9px;
429+
background: #ffffff;
430+
border: 1px solid rgb(208, 208, 208);
373431
}
374432

375-
.lpt-resizableColumn:after {
376-
display: block;
433+
.lpt-searchIcon:before {
377434
position: absolute;
378435
content: "";
379-
right: -5px;
380-
top: 0;
381-
width: 10px;
382-
cursor: col-resize !important;
383-
height: 100%;
436+
left: 1px;
437+
top: 1px;
438+
width: 4px;
439+
height: 4px;
440+
border: 3px solid grey;
441+
border-radius: 5px;
442+
}
443+
444+
.lpt-searchIcon:after {
445+
position: absolute;
446+
content: "";
447+
left: 9px;
448+
top: 7px;
449+
width: 3px;
450+
height: 6px;
451+
background: grey;
452+
border-radius: 1px;
453+
-webkit-transform: rotate(-45deg);
454+
-moz-transform: rotate(-45deg);
455+
-ms-transform: rotate(-45deg);
456+
-o-transform: rotate(-45deg);
457+
transform: rotate(-45deg);
458+
}
459+
460+
.lpt-searchInput {
461+
display: inline-block;
462+
box-sizing: border-box;
463+
font-size: 13px;
464+
padding: 0 4px 0 4px;
465+
margin: 1px 0 0 5px;
466+
border-radius: 10px;
467+
height: 17px;
468+
background: #FFFFFF;
469+
border: 1px solid #D0D0D0;
470+
border-top: none;
471+
border-bottom: none;
472+
outline: none;
384473
}

source/js/DataController.js

+42-2
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,7 @@ DataController.prototype._trigger = function () {
530530
DataController.prototype.sortByColumn = function (columnIndex) {
531531

532532
var data = this._dataStack[this._dataStack.length - 1].data,
533-
totalsAttached = this.SUMMARY_SHOWN
534-
&& this.controller.CONFIG["attachTotals"] ? 1 : 0;
533+
totalsAttached = this.SUMMARY_SHOWN && this.controller.CONFIG["attachTotals"] ? 1 : 0;
535534

536535
if (this.SORT_STATE.column !== columnIndex) {
537536
order = this.SORT_STATE.order = 0;
@@ -579,4 +578,45 @@ DataController.prototype.sortByColumn = function (columnIndex) {
579578

580579
this._trigger();
581580

581+
};
582+
583+
/**
584+
* Filter raw data by part of value.
585+
*
586+
* @param {string} valuePart
587+
* @param {number} columnIndex
588+
*/
589+
DataController.prototype.filterByValue = function (valuePart, columnIndex) {
590+
591+
var data = this._dataStack[this._dataStack.length - 1].data,
592+
totalsAttached = this.SUMMARY_SHOWN && this.controller.CONFIG["attachTotals"] ? 1 : 0,
593+
newRawData = data._rawDataOrigin.slice(
594+
data.info.topHeaderRowsNumber,
595+
data._rawDataOrigin.length - (this.SUMMARY_SHOWN && !totalsAttached ? 1 : 0)
596+
),
597+
re = null;
598+
599+
try {
600+
re = new RegExp(valuePart, "i");
601+
} catch (e) {
602+
try {
603+
re = new RegExp(valuePart.replace(/([()[{*+.$^\\|?])/g, "\\$1"), "i");
604+
} catch (e) {
605+
return;
606+
}
607+
}
608+
609+
newRawData = newRawData.filter(function (row) {
610+
return (row[columnIndex].value || "").toString().match(re);
611+
});
612+
613+
data.rawData = data._rawDataOrigin.slice(0, data.info.topHeaderRowsNumber)
614+
.concat(newRawData)
615+
.concat(this.SUMMARY_SHOWN && !totalsAttached
616+
? [data._rawDataOrigin[data._rawDataOrigin.length - 1]]
617+
: []
618+
);
619+
620+
this._trigger();
621+
582622
};

source/js/LightPivotTable.js

+1
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ LightPivotTable.prototype.getPivotProperty = function (path) {
297297
LightPivotTable.prototype.normalizeConfiguration = function (config) {
298298
if (typeof config["columnResizing"] === "undefined") config.columnResizing = true;
299299
if (typeof config["pagination"] === "undefined") config.pagination = 200;
300+
if (typeof config["enableSearch"] === "undefined") config.enableSearch = true;
300301
if (!config["triggers"]) config.triggers = {};
301302
if (!config["dataSource"]) config.dataSource = {};
302303
};

0 commit comments

Comments
 (0)