@@ -518,9 +518,8 @@ PivotView.prototype.renderRawData = function (data) {
518518 LHTHead = document . createElement ( "thead" ) ,
519519 mainTable = document . createElement ( "table" ) ,
520520 mainTBody = document . createElement ( "tbody" ) ,
521- x , y , tr = null , th , td , primaryColumns = [ ] , primaryRows = [ ] , ratio ;
521+ x , y , tr = null , th , td , primaryColumns = [ ] , primaryRows = [ ] , ratio , cellStyle ;
522522
523- console . log ( "columnProps" , columnProps ) ;
524523 // clean previous content
525524 this . removeMessage ( ) ;
526525 while ( container . firstChild ) { container . removeChild ( container . firstChild ) ; }
@@ -598,7 +597,7 @@ PivotView.prototype.renderRawData = function (data) {
598597 _ . _backClickHandler . call ( _ , e ) ;
599598 } ) ;
600599 }
601- if ( // hide unnesesarry column
600+ if ( // hide unnecessary column
602601 ( this . controller . CONFIG [ "hideButtons" ] || this . tablesStack . length < 2 )
603602 && info . leftHeaderColumnsNumber === 0
604603 ) {
@@ -628,6 +627,7 @@ PivotView.prototype.renderRawData = function (data) {
628627 tr = document . createElement ( "tr" ) ;
629628 for ( x = info . leftHeaderColumnsNumber ; x < rawData [ 0 ] . length ; x ++ ) {
630629
630+ cellStyle = "" ;
631631 tr . appendChild ( td = document . createElement ( "td" ) ) ;
632632 if ( ! isFinite ( rawData [ y ] [ x ] . value ) ) {
633633 td . className += " formatLeft" ;
@@ -646,14 +646,18 @@ PivotView.prototype.renderRawData = function (data) {
646646 && ! ( info . SUMMARY_SHOWN && rawData . length - 1 === y ) // exclude totals formatting
647647 ) {
648648 ratio = ( parseFloat ( rawData [ y ] [ x ] . value ) - colorScale . min ) / colorScale . diff ;
649- td . setAttribute ( "style" , "background:rgb(" +
649+ cellStyle += "background:rgb(" +
650650 + Math . round ( ( colorScale . to . r - colorScale . from . r ) * ratio + colorScale . from . r )
651651 + "," + Math . round ( ( colorScale . to . g - colorScale . from . g ) * ratio + colorScale . from . g )
652652 + "," + Math . round ( ( colorScale . to . b - colorScale . from . b ) * ratio + colorScale . from . b )
653- + ");" + ( colorScale . invert ? "color: white;" : "" ) ) ;
653+ + ");" + ( colorScale . invert ? "color: white;" : "" ) ;
654+ }
655+ if ( columnProps [ x - info . leftHeaderColumnsNumber ] . style ) {
656+ cellStyle += columnProps [ x - info . leftHeaderColumnsNumber ] . style ;
657+ }
658+ if ( rawData [ y ] [ x ] . style ) {
659+ cellStyle += rawData [ y ] [ x ] . style ;
654660 }
655- if ( rawData [ y ] [ x ] . style )
656- td . setAttribute ( "style" , ( td . getAttribute ( "style" ) || "" ) + rawData [ y ] [ x ] . style ) ;
657661 if (
658662 this . controller . CONFIG . conditionalFormattingOn // totals formatting present
659663 && ! ( info . SUMMARY_SHOWN && rawData . length - 1 === y ) // exclude totals formatting
@@ -667,6 +671,8 @@ PivotView.prototype.renderRawData = function (data) {
667671 ) ;
668672 }
669673
674+ // apply style
675+ if ( cellStyle ) td . setAttribute ( "style" , cellStyle ) ;
670676 // add handlers
671677 td . addEventListener ( CLICK_EVENT , ( function ( x , y , cell ) {
672678 return function ( event ) {
0 commit comments