easyui-datagrid行数据field原样输出html标签
2017-11-23 10:56
344 查看
[摘要:easyui-datagrid 绑定的止 field 本样输出html标签。处置惩罚后果如图: Html页里代码以下:...<tr> <th field="id" width="5" align="center">编号</th]
easyui-datagrid 绑定的行 field 原样输出html标签。处理效果如图:
Html页面代码如下:
[html] view plain copy
...
<tr>
<th field="id" width="5" align="center">编号</th>
<th field="name" width="20" align="center" data-options="formatter:formatEncodeHtml">名称</th>
...
处理的js代码如下:
[javascript] view plain copy
function formatEncodeHtml(value, row, index) {
return encodeHtml(value);
}
this.REGX_HTML_ENCODE = /"|&|'|<|>|[\x00-\x20]|[\x7F-\xFF]|[\u0100-\u2700]/g;
function encodeHtml(s) {
return (typeof s != "string") ? s :
s.replace(this.REGX_HTML_ENCODE,
function ($0) {
var c = $0.charCodeAt(0), r = [""];
c = (c == 0x20) ? 0xA0 : c;
r.push(c);
r.push(";");
return r.join("");
});
}
easyui-datagrid 绑定的行 field 原样输出html标签。处理效果如图:
Html页面代码如下:
[html] view plain copy
...
<tr>
<th field="id" width="5" align="center">编号</th>
<th field="name" width="20" align="center" data-options="formatter:formatEncodeHtml">名称</th>
...
处理的js代码如下:
[javascript] view plain copy
function formatEncodeHtml(value, row, index) {
return encodeHtml(value);
}
this.REGX_HTML_ENCODE = /"|&|'|<|>|[\x00-\x20]|[\x7F-\xFF]|[\u0100-\u2700]/g;
function encodeHtml(s) {
return (typeof s != "string") ? s :
s.replace(this.REGX_HTML_ENCODE,
function ($0) {
var c = $0.charCodeAt(0), r = [""];
c = (c == 0x20) ? 0xA0 : c;
r.push(c);
r.push(";");
return r.join("");
});
}
相关文章推荐
- easyui-datagrid行数据field原样输出html标签___http://www.bubuko.com/infodetail-1135412.html
- easyui-datagrid行数据field原样输出html标签
- $.getjson遇到的几个问题-json返回数据中带有html标签的输出
- 从数据库读取数据后将其输出成html标签的三种方法
- 如何原样输出html标签
- html格式 保持原样输出的标签 需加pre标签
- 使用html标签、jQuery-EasyUI和Ext4分别展示json数据的效果
- 从数据库读取数据后将其输出成html标签的三种方法
- 从数据库读取数据后将其输出成html标签的方法
- struts2中,解决property标签原样输出HTML代码的问题
- easyui datagrid 输出数据乱码
- html格式 保持原样输出的标签
- 如何把aspx页面中的某个控件输出成html页面(例如把一个页面中的datagrid数据输出成html格式的页面保存)
- easyui datagrid-detailview.js 子数据表显示BUG
- EasyUI datagrid获取一行数据
- easyui datagrid combobox下拉框获取数据问题
- easyUI-datagrid 初始化数据为50条的问题
- js循环生成多个easyui datagrid数据网格时,初始化表格
- Angular.js数据绑定时自动转义html标签及内容
- 再次谈谈easyui datagrid 的数据加载