easyui formatter实现超链接效果
2016-06-12 11:57
417 查看
formatter是格式化的意思,也就是以何种形式呈现的意思。项目中需要在easyui-datagrid的某一列做成超链接的效果,点击并能够出现一个弹出框;
formatter该属性是一个函数,它包含两个参数: value: 对应字段的当前列的值,record: 当前行的记录数据。
页面代码:
JS代码:
注意事项
formatter函数不会作用在列属性checkbox为true的单元格上,checkbox列是组件预留的
formatter该属性是一个函数,它包含两个参数: value: 对应字段的当前列的值,record: 当前行的记录数据。
页面代码:
<span style="font-family:SimSun;font-size:18px;"><table id="dg" class="easyui-datagrid" style="width: 1000px" data-options=" rownumbers:true,striped:true,loadMsg:'正在加载用户信息',singleSelect:true,method:'get',pagination:true,url:'/CadresRate/queryAllDocument',pageSize:20,pageList:[10,20,30,40,50],pageNumber:1,toolbar:toolbar"> <thead> <tr style="width: 100%"> <th data-options="field:'DocumentName',width:180 ,<strong>formatter:FileUrl</strong>">文件名称</th> </tr> </thead> </table></span>
JS代码:
<span style="font-family:SimSun;font-size:18px;"><script type="text/javascript"> function FileUrl(value, rowData) { if (value == null || value == "") { return "<a href='javascript:void(0)'onclick=showImg('" + value + "');><a/>"; } else { return "<a href='javascript:void(0)'onclick=showImg('" + value + "');>" + value + "<a/>"; } } </script></span>
注意事项
formatter函数不会作用在列属性checkbox为true的单元格上,checkbox列是组件预留的
相关文章推荐
- UIButton中setTitleEdgeInsets和setImageEdgeInsets的使用
- Android UI-开源框架ImageLoader的完美例子
- UIViewContentMode各类型效果
- 浅谈如何实现easyui的datebox格式化
- POJ-1458 Common Subsequence
- UI各种效果库
- Android基础UI组件
- UILabel的行间距
- UIView 中的控件事件穿透 Passthrough 的实现
- javax.persistence.PersistenceException: [PersistenceUnit: cmf.server] Unable to build EntityManagerF
- android UI——分组+悬停 listview
- 卡特兰数变形之Unique Binary Search Trees II
- “could not build module UIKit”问题的解决
- 设置soapui 最大设置访问时间
- minigui杂项
- IOS Dev Intro - Key-Value Observing
- Android,UI主线程与子线程
- Kendo UI常用示例汇总(十二)
- android:windowIsTranslucent="true"透明style与横竖屏切换的冲突
- Ueditor设置默认字体、字号、行间距,添加字体种类