@@ -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 */
113113DataController . 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.
0 commit comments