1
JQueryを使用してDatatableを作成し、最初の列に基づいてソートしようとしています。この列には、リンクとプレーンテキストの両方が含まれます。JQuery Datatables:リンクとプレーンテキストが別々にソートされる
jQueryのは、明らかにそれらを別々にソートし、その最初のリンクをアルファベット順やアルファベット順に、プレーンテキストの下。
すべてのテキスト形式が同じと見なされるように、どのように組み合わせて使用できますか? 私はすでに列型定義、カスタム注文定義などのソリューションをたくさん試しました...どれも正しく動作しません。
$(document).ready(function() {
$('#toollist').dataTable({
"iDisplayLength": 10,
"scrollY": "500px",
"scrollCollapse": true,
"lengthMenu": [5, 10, 25, 50, 100],
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css"/>
<table id="toollist" class="table display table-bordered">
<thead>
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="https://www.google.com">
<strong>A</strong></a></td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>
<strong>A</strong></td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>
<strong>B</strong></td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>
<a href="https://www.google.com">
<strong>B</strong></a></td>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td>
<a href="https://www.google.com">
<strong>C</strong></a></td>
<td>D</td>
<td>E</td>
</tr>
<tr>
<td>
<strong>C</strong></td>
<td>D</td>
<td>E</td>
</tr>
</tbody>
</table>
私はあなたがここにあなたの解決策を見つけるかもしれないと思う:あなたのリンクのためのhttps://datatables.net/development/sorting – Difster
感謝を。残念ながら – Jon
が、それはあなたがデフォルトの動作を壊し、あなたのコードに何かを追加したことがある:(私は前にこれを試してみました、それが動作しない? – Difster