Skip to content

Commit 6566b53

Browse files
conditional formatting model
1 parent 1473757 commit 6566b53

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

gulpfile.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ gulp.task("zipRelease", ["exportCacheXML"], function () {
9898
.pipe(gulp.dest("build"));
9999
});
100100

101+
gulp.task("desktop", ["default"], function () {
102+
return gulp.src("build/Caché/*")
103+
.pipe(gulp.dest("C:/Users/ZitRo/Desktop"));
104+
});
105+
101106
gulp.task("default", [
102107
"clean", "gatherScripts", "gatherCSS", "addExample", "copyLICENSE", "copyREADME",
103108
"exportCacheXML", "zipRelease"

source/js/DataController.js

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ DataController.prototype.setData = function (data) {
8888
this._dataStack[this._dataStack.length - 1].data = data;
8989
//this.data = data;
9090
this.resetDimensionProps();
91+
this.resetConditionalFormatting();
9192
this.resetRawData();
93+
console.log("Data:", data);
9294

9395
this._trigger();
9496
return data;
@@ -107,16 +109,14 @@ DataController.prototype.setDrillThroughHandler = function (handler) {
107109

108110
/**
109111
* Sets properties of rows/columns.
110-
*
111-
* @returns {null}
112112
*/
113113
DataController.prototype.resetDimensionProps = function () {
114114

115115
var data, columnProps = [];
116116

117117
if (!(data = this._dataStack[this._dataStack.length - 1].data)) {
118118
console.error("Unable to get dimension props for given data set.");
119-
return null;
119+
return;
120120
}
121121

122122
var parse = function (obj, props) {
@@ -143,6 +143,32 @@ DataController.prototype.resetDimensionProps = function () {
143143

144144
};
145145

146+
DataController.prototype.resetConditionalFormatting = function () {
147+
148+
var data,
149+
cfArr = {/* "[y],[x]|<null>": Array[{style:"", operator: "", ...}] */},
150+
ocfArr;
151+
152+
if (!(data = this._dataStack[this._dataStack.length - 1].data)) {
153+
console.error("Unable to get conditional formatting for given data set.");
154+
return;
155+
}
156+
if (!(this.controller.CONFIG.pivotProperties)) {
157+
data.conditionalFormatting = cfArr;
158+
return;
159+
}
160+
161+
ocfArr = this.controller.CONFIG.pivotProperties["formatRules"] || [];
162+
for (var i in ocfArr) {
163+
// Warn: range ",2-3" is valid for standard pivot as ",2".
164+
// LPT will parse ",2-3" range as invalid.
165+
if (!cfArr[ocfArr[i]["range"]]) cfArr[ocfArr[i]["range"]] = [];
166+
cfArr[ocfArr[i]["range"]].push(ocfArr[i]);
167+
}
168+
data.conditionalFormatting = cfArr;
169+
170+
};
171+
146172
/**
147173
* Total functions definition. When adding new total function, also check getTotalFunction.
148174
* "this" in context of functions equals to TOTAL_FUNCTIONS object.

source/js/DataSource.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ DataSource.prototype.getCurrentData = function (callback) {
162162

163163
var data = ready.data;
164164

165-
//console.log("Retrieved data:", ready);
165+
console.log("Retrieved data:", ready);
166166

167167
(data.Info || {}).action = _.ACTION;
168168
if (_.ACTION === "MDXDrillthrough") {

0 commit comments

Comments
 (0)