easyui 中的datagrid用json数据动态绑定列后,如何给里面的数据加上超链接,谢谢!

hclhuagong 2015-06-08 08:40:16
如题!谢谢!!!!!!!!!!!!
...全文
140 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
tangjun147 2015-06-10
  • 打赏
  • 举报
回复

<table class="easyui-datagrid" title="文档列表" id="dg" pagination="true" style="height:98%"
		data-options="toolbar:'#ft',
		pagination:true,
		pageSize:10
		">
		<thead>
			<tr>
				<th data-options="field:'wordname',width:180,halign:'center'">文档名称</th>
				<th data-options="field:'wordtype',width:100,halign:'center',align:'center'">文档类型</th>
				<th data-options="field:'createtime',width:150,halign:'center',align:'center'">上传时间</th>
				<th data-options="field:'createby',width:180,halign:'center',align:'center'">上传用户</th>
				<th field="opt" formatter='optFormater' width="150" halign="center" align="center">操作</th>
			</tr>
		</thead>
</table>

//DataGrid操作栏
	function optFormater(value, row, index) {
		var wordId = row.id;
		var wordurl = row.wordurl;
		var wordname = row.wordname;
		var del = '<a href="WordList!deleteData.action?wordname=' + encodeURI(encodeURI(wordname)) + '&id=' + wordId + '&url=' + wordurl
				+ '" onclick="return confirm(' + "'确定删除?'" + ');">删除</a> | ';
		var preview = '<a href="documentView.jsp?url=' + wordurl
				+ '" target="_bank">预览</a>';
		return del + preview;
	}
tony4geek 2015-06-10
  • 打赏
  • 举报
回复
    formatter 的函数。
Braska 2015-06-09
  • 打赏
  • 举报
回复
{field:'opt',title:'修改',width:100,align:'center', rowspan:2,
					formatter:function(value,rec,index){
						var e = '<span style="color:blue;"><a href="javascript:void(0);" style="text-decoration: none;font-weight:bold;" onclick="edit(\''+rec.id+'\')">编辑</a></span>';
						return e;
					}
				}

87,838

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧