[英]jQuery , datatables converting cells
我使用jquery(www.datatables.net)的DataTables插件。 如何像這樣轉換細胞
name www
n1 w1
n2 w2
n3 w3
name www
成為
name www
n1 <a href="w1">w1</a>
n2 <a href="w2">w2</a>
n3 <a href="w3">w3</a>
name www
在jquery中安裝代碼在這里:
$(document).ready(function() {
$('#example').dataTable();
$('#example').convertCell(setCell("<a href="getCell()">getCell()</a>"));//How to put it better?
});
和html代碼是
<div id="dynamic">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th width="15%">Name</th>
<th width="15%">Www</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
問候:數據表中的初學者
我不確定插件,但是您可以使用:
$('.example').each(function(){
$(this).wrap(function() {
return '<a href="' + $(this).text() + '" />';
});
});
將使用.example
類將每個元素包裝在指向每個文本的鏈接中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.