doujiu9172 2013-08-05 17:20
浏览 294

Kendo UI网格返回带有html标签的json字符串

my script transaction.php return following json format

    $TransactionSumary[0] = array(
        'ExchangeRate' => 'USD = 7,800 | THB 250',
        'Total' => '250,000 LAK',
        'VAT'   => '25,000 LAK',
        'GrandTotalUSD' => '15.00',
        'GrandTotalTHB' => '1,000',
        'GrandTotalLAK' => '<span class="k-block k-success-colored">250,000</span>',
);

echo $_GET['callback']."(".json_encode($TransactionSumary).")";

Please look at GrandTotalLAK, it contain some HTML tags,

the problem is the GrandTotalLAK is not display as HTML format property it shown as flat character <span class="k-block k-success-colored">250,000</span> in Kendo UI Grid,

If I use base64_encode("<span class="k-block k-success-colored">250,000</span>"), and how to decode it in Kendo UI Grid column properties?

here is the Kendo UI Grid cloumn property

{ field:"GrandTotalLAK", title: "Grand Total (LAK)", width: "20%" },

Thank you very much!

OK after some Google I found solution

<div id="grid"></div> <script> $("#grid").kendoGrid({ columns: [ { field: "name", encoded: false } ], dataSource: [ { name: "<strong>Jane Doe</strong>" } ] }); </script>

  • 写回答

2条回答 默认 最新

  • dongzan7016 2013-08-09 04:05
    关注

    rather then passing the html on GrandTotalLak, just pass the value and set the template for that particular columns to how you want to display.

    for eg:-

     <script id="column_template" type="text/x-kendo-template">
        <span class="k-block k-success-colored"> #= GrandTotalLAK #</span>
     </script>
    

    then inside the columns of your specific field define the above template id like

    template: kendo.template(jQuery("#column_template").html()),
    

    I hope it helpful.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?