diff --git a/src/slick.grid.ts b/src/slick.grid.ts index d8d7e500..14f0ee14 100644 --- a/src/slick.grid.ts +++ b/src/slick.grid.ts @@ -543,11 +543,18 @@ export class SlickGrid = Column, O e return; } - // apply HTML when enableHtmlRendering is enabled but make sure we do have a value (without a value, it will simply use `textContent` to clear text content) - if (this._options.enableHtmlRendering && val) { - target.innerHTML = this.sanitizeHtmlString(val as string); + let sanitizedText = val; + if (typeof sanitizedText === 'number' || typeof sanitizedText === 'boolean') { + target.textContent = sanitizedText; } else { - target.textContent = this.sanitizeHtmlString(val as string); + sanitizedText = this.sanitizeHtmlString(val as string); + + // apply HTML when enableHtmlRendering is enabled but make sure we do have a value (without a value, it will simply use `textContent` to clear text content) + if (this._options.enableHtmlRendering && sanitizedText) { + target.innerHTML = sanitizedText; + } else { + target.textContent = sanitizedText; + } } } }