我使用datatables(http://datatables.net/)来创建带有JSON的表,我有一个代码:
<script type="text/javascript">
$(document).ready(function() {
$('#example').dataTable( {
"ajax": "objects.txt",
"columns": [
{ "data": "name" },
{ "data": "position" },
{ "data": "office" },
{ "data": "extn" },
{ "data": "start_date" },
{ "data": "salary" }
]
} );
} );
</script>
<div class="container">
<table id="example" class="table table-striped table-bordered table-responsitive" cellspacing="0" width="100%">
<thead>
<tr>
<th>DAN</th>
<th>Aktivnost</th>
<th>Vreme</th>
<th>Rashodi</th>
<th>Prihodi</th>
<th>Beleske</th>
</tr>
</thead>
<tfoot>
<tr>
<th>DAN</th>
<th>Aktivnost</th>
<th>Vreme</th>
<th>Rashodi</th>
<th>Prihodi</th>
<th>Beleske</th>
</tr>
</tfoot>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
当我点击某个单元格时,如何获取行的名称和列的名称?另外,当点击表格中的某个单元格时,如何获取行的ID和列的ID?