【发布时间】:2014-12-26 02:47:33
【问题描述】:
我使用数据表 (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>
单击某个单元格时如何获取行名和列名? 还有当点击表格中的某个单元格时如何获取行ID和列ID?
【问题讨论】:
标签: javascript jquery datatable