jQuery를 dataTables Plugin과 함께 사용합니다. dataTables는 행을 열고 닫을 수있는 기능을 제공합니다. 추가 정보 행을 일반 행 아래 열 수 있음을 의미합니다.jQuery HTMLElement 포장/풀기
$(document).ready(function() {
var oTable;
// 'open' an information row when a row is clicked on
$('#example tbody tr').click(function() {
if (oTable.fnIsOpen(this)) {
oTable.fnClose(this);
} else {
oTable.fnOpen(this, "Temporary row opened", "info_row");
}
});
oTable = $('#example').dataTable();
});
가 지금은 전체 행에 있지 클릭 처리기를 추가 할 수 있지만, 행의 요소 :
$("#openCompliantsTable .icon-comment").click(…
그러나 http://datatables.net/api에서 내가 잘 작동 다음 예제있어
물론 this
은 tr
요소를 참조하지 않고 일부 자식 요소를 참조합니다. 코드를 변경하려는 시도는 을 $(this).parent().parent().get()
으로 바꾸는 것이었지만 작동하지 않았습니다.
this
모두가 나를 놀라게
[object HTMLElement]
객체 경우에도
$(this).get()
과 동일하지 않는 것 같습니다 것을 발견했다.
이 제안을 받으려면 어떤 제안을 원하십니까?
편집 : 내 HTML 테이블은 다음과 같다 : 매개 변수없이
<table id="openCompliantsTable" class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Reklamationsnummer</th>
<th>Reklapositionsnummer</th>
...
<th>Status</th>
<th>Aktion</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1</td>
...
<td>offen</td>
<td><i class="icon-ok"></i><i class="icon-trash"></i><i class="icon-flag"></i><i class="icon-comment"></i></td>
</tr>
...
</tbody>
</table>
정말 $ (this) .parent(). parent()'가 TR 요소를 찾았습니까? –
예, 일부 CSS 클래스를 추가 할 수 있습니다. – thorink