最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to put HTML into Slickgrid cell? - Stack Overflow

programmeradmin1浏览0评论

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?

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?

Share Improve this question edited Feb 18, 2016 at 8:26 John Slegers 47.1k23 gold badges204 silver badges173 bronze badges asked Mar 23, 2012 at 14:03 enesnessenesness 3,1335 gold badges32 silver badges33 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 15

Write a custom formatter:

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

and specify it in the column definition.

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(); 
} 
发布评论

评论列表(0)

  1. 暂无评论