我想implmenting數據表,但它是給錯誤:遺漏的類型錯誤:未定義不是一個功能 - 數據表
遺漏的類型錯誤:$(...)數據表上不是一個函數
的我試圖代碼:
<script type="text/javascript" src="../assets/styles/components/data-tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="../assets/styles/components/data-tables/DT_bootstrap.js"></script>
<script>
$(document).ready(function() {
$('#sample_1').dataTable({
"sDom": "<'row'<'col-sm-6'l><'col-sm-6'f>r>t<'row'<'col-sm-6'i><'col-sm-6'p>>",
"sPaginationType": "bootstrap",
"oLanguage": {
"sLengthMenu": "_MENU_ records per page",
"oPaginate": {
"sPrevious": "Prev",
"sNext": "Next"
}
},
"aoColumnDefs": [{
'bSortable': false,
'aTargets': [0]
}]
});
jQuery('#sample_1 .group-checkable').change(function() {
var set = jQuery(this).attr("data-set");
var checked = jQuery(this).is(":checked");
jQuery(set).each(function() {
if (checked) {
$(this).attr("checked", true);
} else {
$(this).attr("checked", false);
}
});
jQuery.uniform.update(set);
});
jQuery('#sample_1_wrapper .dataTables_filter input').addClass("form-control");
jQuery('#sample_1_wrapper .dataTables_length select').addClass("form-control");
});
</script>
這裏是我的html代碼:
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped border-top" id="sample_1">
<thead>
<tr>
<th>No.</th>
<th>Date</th>
<th>Time</th>
<th>Contract</th>
<th>Deposit</th>
<th>Price</th>
<th>Buy # of Contracts</th>
<th>Sell # of Contracts</th>
<th>P&L </th>
<th>Expiry Time</th>
<th>Settlement Payout</th>
<th>Fee Payment</th>
<th>Sell to Close</th>
<th>Buy to Close</th>
</tr>
</thead>
<tbody>
<tr class="odd gradeX">
<td>1</td>
<td>04-01-2015</td>
<td>09:33 AM</td>
<td>EUR/JPY </td>
<td></td>
<td>118</td>
<td></td>
<td>2</td>
<td>-118</td>
<td>3PM</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="odd gradeX">
<td>2</td>
<td>04-01-2015</td>
<td>09:33 AM</td>
<td>EUR/JPY </td>
<td></td>
<td>118</td>
<td></td>
<td>2</td>
<td>-1.8</td>
<td>3PM</td>
<td></td>
<td>-1.8</td>
<td></td>
<td></td>
</tr>
<tr class="odd gradeX">
<td>3</td>
<td>04-01-2015</td>
<td>09:43 AM</td>
<td>EUR/JPY </td>
<td></td>
<td>80</td>
<td></td>
<td>2</td>
<td>80</td>
<td>3PM</td>
<td></td>
<td></td>
<td></td>
<td>80</td>
</tr>
<tr class="odd gradeX">
<td>4</td>
<td>04-01-2015</td>
<td>09:43 AM</td>
<td>EUR/JPY </td>
<td></td>
<td>80</td>
<td></td>
<td>2</td>
<td>-0.9</td>
<td>3PM</td>
<td></td>
<td>-0.9</td>
<td></td>
<td></td>
</tr>
<tr class="odd gradeX">
<td>5</td>
<td>04-01-2015</td>
<td>09:45 AM</td>
<td>EUR/JPY </td>
<td></td>
<td>80</td>
<td></td>
<td>2</td>
<td>80</td>
<td>3PM</td>
<td></td>
<td></td>
<td></td>
<td>80</td>
</tr>
<tr class="odd gradeX">
<td>6</td>
<td>04-01-2015</td>
<td>09:45 AM</td>
<td>EUR/JPY </td>
<td></td>
<td>80</td>
<td></td>
<td>2</td>
<td>-0.9</td>
<td>3PM</td>
<td></td>
<td>-0.9</td>
<td></td>
<td></td>
</tr>
<tr class="odd gradeX">
<td>7</td>
<td>04-01-2015</td>
<td>10:28 PM</td>
<td>AUD/USD </td>
<td></td>
<td>111.5</td>
<td>2</td>
<td>2</td>
<td>-88.5</td>
<td>11AM</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="odd gradeX">
<td>8</td>
<td>04-01-2015</td>
<td>10:28 PM</td>
<td>AUD/USD </td>
<td></td>
<td>111.5</td>
<td>2</td>
<td>2</td>
<td>-1.8</td>
<td>11AM</td>
<td></td>
<td>-1.8</td>
<td></td>
<td></td>
</tr>
<tr class="odd gradeX">
<td>9</td>
<td>04-21-2015</td>
<td>01:00 PM</td>
<td></td>
<td>5000</td>
<td>0</td>
<td>2</td>
<td>2</td>
<td>5000</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
不熟悉的庫,但文件表明,它是'.DataTable'大寫D. – JJJ
哪裏是HTML代碼? –
@Juhana它是'.DataTable()'在[本網站](https://www.datatables.net)上,但它是'.dataTable()'[here](https://github.com/DataTables /數據表)。誰知道OP使用什麼... – Regent