Don't double encode text in StringFormatter
@@ -9,7 +9,7 @@ import {Model} from "../../../model"
export class CellFormatter extends Model
doFormat: (row, cell, value, columnDef, dataContext) ->
- if value == null
+ if not value?
return ""
else
return (value + "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;")
@@ -24,14 +24,11 @@ export class StringFormatter extends CellFormatter
}
doFormat: (row, cell, value, columnDef, dataContext) ->
- text = super(row, cell, value, columnDef, dataContext)
-
font_style = @font_style
text_align = @text_align
text_color = @text_color
- if font_style? or text_align? or text_color?
- text = span({}, text)
+ text = span({}, if not value? then "" else "#{value}")
switch font_style
when "bold"
text.style.fontWeight = "bold"
@@ -44,7 +41,6 @@ export class StringFormatter extends CellFormatter
text.style.color = text_color
text = text.outerHTML
-
return text
export class NumberFormatter extends StringFormatter
