File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,12 +165,28 @@ Module.register("MMM-JsonTable", {
165165 buildCell ( key , value ) {
166166 const cell = document . createElement ( "td" ) ;
167167 let valueToDisplay = "" ;
168+ let cellValue = "" ;
169+
170+ if ( value !== null && typeof value === "object" && ! Array . isArray ( value ) ) {
171+ if ( "value" in value ) {
172+ cellValue = value . value ;
173+ } else {
174+ cellValue = "" ;
175+ }
176+
177+ if ( "color" in value ) {
178+ cell . style . color = value . color ;
179+ }
180+ } else {
181+ cellValue = value ;
182+ }
183+
168184 if ( key === "icon" ) {
169- cell . classList . add ( "fa" , value ) ;
185+ cell . classList . add ( "fa" , cellValue ) ;
170186 } else if ( this . config . tryFormatDate ) {
171- valueToDisplay = this . getFormattedValue ( value ) ;
187+ valueToDisplay = this . getFormattedValue ( cellValue ) ;
172188 } else {
173- valueToDisplay = value ;
189+ valueToDisplay = cellValue ;
174190 }
175191 let textContent = "" ;
176192 if ( valueToDisplay === null || typeof valueToDisplay === "undefined" ) {
You can’t perform that action at this time.
0 commit comments