您的位置:首页 > Web前端 > JQuery

jQuery EasyUI - Add link to datagrid cell

2014-02-14 09:25 1416 查看
Extracted from: http://stackoverflow.com/questions/16061894/jquery-easyui-add-link-to-cell
HTML:

<table id="dgContactSearch" title="Benutzer Suche" class="easyui-datagrid" style="height:160px"
url="getContacts.php"
toolbar="#toolbarContactSearch" pagination="true"
rownumbers="true" fitColumns="true" singleSelect="true">
<thead>
<tr>
<th data-options="field:'firma',width:80,align:'left',formatter:formatCustomerId">Kunde</th>
<th data-options="field:'name',width:50,align:'left',formatter:formatContactUrl">Name</th>
<th field="function" width="50">Funktion</th>
<th field="phone" width="50">Phone</th>
<th field="email" width="50">Email</th>
<th field="mobile" width="50">Mobile</th>
<th field="fax" width="50">Fax</th>

<th field="comment" width="120">Kommentare</th>
</tr>
</thead>
</table>


Javascript:

<script>
function formatCustomerId(val,row){
var url = "customerView.php?id=";
return '<a href="'+url + row.customer_id+'">'+val+'</a>';
}

function formatContactUrl(val,row){
var url = "contactView.php?id=";
return '<a href="'+url + row.id+'">'+val+'</a>';
}
</script>


REF:
http://blog.csdn.net/com360/article/details/6537074 http://www.jeasyui.com/documentation/datagrid.php http://jeasyui.com/demo/main/index.php?plugin=DataGrid http://www.thinkphp.cn/code/207.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: