easyui formatter实现超链接效果

    formatter是格式化的意思,也就是以何种形式呈现的意思。项目中需要在easyui-datagrid的某一列做成超链接的效果,点击并能够出现一个弹出框;

    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)'οnclick=showImg('" + value + "');><a/>";
        } else {
            return "<a href='javascript:void(0)'οnclick=showImg('" + value + "');>" + value + "<a/>";
        }
    }

</script></span>

注意事项

formatter函数不会作用在列属性checkbox为true的单元格上,checkbox列是组件预留的




评论 20
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值