jQuery EasyUI - Add link to datagrid cell

Extracted from: http://stackoverflow.com/questions/16061894/jquery-easyui-add-link-to-cell

HTML:

 1 <table id="dgContactSearch" title="Benutzer Suche" class="easyui-datagrid" style="height:160px" 
 2                             url="getContacts.php"
 3                             toolbar="#toolbarContactSearch" pagination="true"
 4                             rownumbers="true" fitColumns="true" singleSelect="true">
 5                         <thead>
 6                             <tr>
 7                                 <th data-options="field:‘firma‘,width:80,align:‘left‘,formatter:formatCustomerId">Kunde</th>
 8                                 <th data-options="field:‘name‘,width:50,align:‘left‘,formatter:formatContactUrl">Name</th>
 9                                 <th field="function" width="50">Funktion</th>
10                                 <th field="phone" width="50">Phone</th>
11                                 <th field="email" width="50">Email</th>
12                                 <th field="mobile" width="50">Mobile</th>
13                                 <th field="fax" width="50">Fax</th>
14 
15                                 <th field="comment" width="120">Kommentare</th>
16                             </tr>
17                         </thead>
18 </table>
 

 Javascript:

 1 <script>
 2 function formatCustomerId(val,row){
 3     var url = "customerView.php?id=";
 4     return ‘<a href="‘+url + row.customer_id+‘">‘+val+‘</a>‘;
 5 }
 6 
 7 function formatContactUrl(val,row){
 8     var url = "contactView.php?id=";
 9     return ‘<a href="‘+url + row.id+‘">‘+val+‘</a>‘;
10 }
11 </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

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。