7

When I put <a href="#">Click</a> into slickgrid, I see the actual code "<a href="#">Click</a>", whereas I expect the link to be rendered.

I know I can do it by subscribing click event but is it restricted thing in SlickGrid?

John Slegers
  • 45,213
  • 22
  • 199
  • 169
enesness
  • 3,123
  • 5
  • 31
  • 33

2 Answers2

15

Write a custom formatter:

function myFormatter(row, cell, value, columnDef, dataContext) {
  return "<a href='#'>Click</a>";
}

and specify it in the column definition.

Tin
  • 9,082
  • 2
  • 34
  • 32
  • 4
    Or use the defaultFormatter option to treat any value as HTML: ` defaultFormatter: function (row, cell, value, columnDef, dataContext) { if (value == null) return ''; return value.toString(); } ` – Ricardo Stuven Feb 20 '13 at 11:40
6

From @RicardoStuven

Or use the defaultFormatter option to treat any value as HTML:

defaultFormatter: function (row, cell, value, columnDef, dataContext) { 
    if (value == null) return ''; 

     return value.toString(); 
} 
Toby Allen
  • 10,997
  • 11
  • 73
  • 124