• easyui-datagrid行数据field原样输出html标签


    [摘要:easyui-datagrid 绑定的止 field 本样输出html标签。处置惩罚后果如图: Html页里代码以下:...<tr> <th field="id" width="5" align="center">编号</th] 

    easyui-datagrid 绑定的行 field 原样输出html标签。处理效果如图:

    Html页面代码如下:

    [html] view plain copy
     
    1. ...  
    2. <tr>  
    3.         <th field="id" width="5" align="center">编号</th>  
    4.         <th field="name" width="20" align="center" data-options="formatter:formatEncodeHtml">名称</th>  
    5. ...  

    处理的js代码如下:

    [javascript] view plain copy
     
    1. function formatEncodeHtml(value, row, index) {  
    2.     return encodeHtml(value);  
    3. }  
    4. this.REGX_HTML_ENCODE = /"|&|'|<|>|[x00-x20]|[x7F-xFF]|[u0100-u2700]/g;  
    5. function encodeHtml(s) {  
    6.     return (typeof s != "string") ? s :  
    7.             s.replace(this.REGX_HTML_ENCODE,  
    8.                     function ($0) {  
    9.                         var c = $0.charCodeAt(0), r = ["&#"];  
    10.                         c = (c == 0x20) ? 0xA0 : c;  
    11.                         r.push(c);  
    12.                         r.push(";");  
    13.                         return r.join("");  
    14.                     });  
    15. }  
  • 相关阅读:
    python3获取文件夹大小
    git master分支被污染,dev是最新稳定的
    优化经验杂记
    kong
    prometheus
    C# 线程执行带参方法的几种写法(ThreadStart,delegate (),()=>)
    MySql字符集utf8mb4和utf8区别
    程序员必备的一些数学基础知识
    hbase统计表的行数的三种方法
    Flink实时计算pv、uv的几种方法
  • 原文地址:https://www.cnblogs.com/soundcode/p/7883743.html
Copyright © 2020-2023  润新知