[英]Click one datatable, fill second datatable
I have 2 datatables and what I wan is to fill the second datatable depending on witch row of the first datatable I clicked. 我有2个数据表,我想要填充第二个数据表取决于我点击的第一个数据表的巫婆行。 Some sort of master-detail.
某种主要细节。
This is the master datatable: 这是主数据表:
<table id="tinzidentziak" class="table table-bordered table-striped dataTable" role="grid" aria-describedby="example1_info">
<thead>
<tr>
<th>Id</th>
<th>Inzidentzia</th>
<th>Erabiltzailea</th>
<th>Engine version</th>
<th></th>
</tr>
</thead>
<tbody>
{% for i in inzidentziak %}
<tr>
<td>{{ i.id }}</td>
<td>{{ i.izena }}</td>
<td>{{ i.userid }}</td>
<td>{{ i.teknikoa }}</td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
This is the detail datatable: 这是详细数据表:
<table id="tdeiak" class="table table-bordered table-striped dataTable">
<thead>
<tr>
<th>id</th>
<th>Fetxa</th>
<th>Nork</th>
<th>Teknikoa</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
The first datatable is working ok, the problem comes when I tried to load the second datatable, I tried with this: 第一个数据表工作正常,当我尝试加载第二个数据表时出现问题,我试过这个:
var table = $('#tinzidentziak').DataTable();
$('#tinzidentziak tbody').on( 'click', 'tr', function () {
var midata=table.row( this ).data();
$('#tdeiak').Datatable({
"ajax": "deiak.json"
});
} );
I tried first without any parameter, just for check if it´s possible to load the second datatable this way. 我先尝试没有任何参数,只是为了检查是否有可能以这种方式加载第二个数据表。 I´ve got this error:
我有这个错误:
Uncaught TypeError: $(...).Datatable is not a function
on the line $('#tdeiak').Datatable({
在行
$('#tdeiak').Datatable({
Any help or clue? 任何帮助或线索?
It's DataTable
not Datatable
它是
DataTable
而不是Datatable
Change 更改
$('#tdeiak').Datatable({
"ajax": "deiak.json"
});
to 至
$('#tdeiak').DataTable({
"ajax": "deiak.json"
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.