現在、次のhtmlテーブルがあります。
<table id="datatable">
<thead>
<th>fruits</th>
<th>vegs</th>
</thead>
<tbody>
<tr>
<td>apple</td>
<td>potato</td>
</tr>
<tr>
<td>apple</td>
<td>carrot</td>
</tr>
</tbody>
</table>
そして、次のように名前で列を参照したいと思います。
<script type="text/javascript">
$(document).ready(function() {
/* Init the table */
var oTable = $('#datatable').dataTable( );
//get by sTitle
console.log(oTable);
var row = oTable.fnGetData(1)
console.log(row['vegs']);//should return 'carrot'
} );
</script>
fnGetData()
データソースがDOMの場合、配列ではなくオブジェクトを返すjavascript関数を使用する方法はありますか?