且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在kendo ui网格列中显示格式化的HTML数据

更新时间:2022-12-15 16:15:22

您应定义列模板.

示例:

<script id="ob-template" type="text/x-kendo-template">
    <div class="class1"> 
        <div>This is <strong>bold </strong>text.</div>
        <div> </div>
        <div>This is <em>italics</em> text.</div>
        <div> </div>
        <div>This is a <a href="http://google.com/">hyperlink</a>.</div>
        <div> </div>
        <div>Bulleted list:</div>
        <ul>
            <li>Bullet #1</li>
            <li>Bullet #2</li>
            <li>Bullet #3</li>
        </ul>
     </div>
</script>

然后,当您定义列时使用它:

and then, when you define the columns use it:

$("#grid").kendoGrid({
  dataSource: ...,
  columns: [ 
    { field: "...", title: "...", template: $("#ob-template").html()}
  ]
});