0
我有一個頁面,我想把兩個或更多的DataTables抓取Ajax數據。出現這種情況的問題是,第一填充數據表,但試圖填補該錯誤消息的第二時:在一個頁面源中的兩個DataTable源Ajax請求
數據表警告:試圖初始化一個節點上的數據表是不是表:DIV
<script type="text/javascript">
var oTableSetor;
var oTableEstoque;
function dtConvFromJSON(data)
{
return data;
}
$(document).ready(function() {
$('.dataTable').dataTable();
GridProdutoLote();
GridProdutoEstoque();
});
function GridProdutoLote() {
if (oTableSetor===undefined)
{
oTableGrid = $('#lista_lote').dataTable({
"bServerSide": true,
"sAjaxSource": '@Html.Raw(@Url.Action("ListaGenerica", "Home", new { aController = "ProdutoLote", filtroID = @Model.ProdutoID }))',
"bProcessing": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "mDataProp": "ProdutoLoteID", "sTitle": "ID"},
{ "mDataProp": "Lote", "sTitle": "Lote" },
{ "mDataProp": "Identificacao", "sTitle": "Identificação"},
{ "mDataProp": "DtFabricacao", "sTitle": "Dt. Fabricação", "mRender": function (data, type, full) { return dtConvFromJSON(data); } },
{ "mDataProp": "DtValidade", "sTitle": "Dt. Validade", "mRender": function (data, type, full) { return dtConvFromJSON(data); }},
{ "mDataProp": "QtdeAtual", "sTitle": "Qtde. Atual"},
{ "mDataProp": "QtdeEmUtilizacao", "sTitle": "Qtde. em Utilizacao"},
{ "mData": null, "bSortable": false, "fnRender": function (o) {return '<a class="icone_16x16_detalhe" href=/Setor/Detalhar/' + o.aData["ProdutoLoteID"] + '>D</a>';}}
],
});
}
};
function GridProdutoEstoque() {
if (oTableEstoque===undefined)
{
oTableEstoque = $('#grid_estoque').dataTable({
"bServerSide": true,
"sAjaxSource": '@Html.Raw(@Url.Action("ListaGenerica", "Home", new { aController = "ProdutoEstoque", filtroID = @Model.ProdutoID }))',
"bProcessing": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "mDataProp": "ProdutoEstoqueID", "sTitle": "ID"},
{ "mDataProp": "Identificacao", "sTitle": "Identificação"},
{ "mDataProp": "Lote", "sTitle": "Lote", "mRender": function (data, type, full) { return dtConvFromJSON(data); } },
{ "mDataProp": "QtdeMinima", "sTitle": "QtdeMinima", "mRender": function (data, type, full) { return dtConvFromJSON(data); }},
{ "mDataProp": "QtdeAtual", "sTitle": "Qtde. Atual"},
{ "mDataProp": "QtdeEmUtilizacao", "sTitle": "Qtde. em Utilizacao"},
{ "mData": null, "bSortable": false, "fnRender": function (o) {return '<a class="icone_16x16_detalhe" href=/Setor/Detalhar/' + o.aData["ProdutoEstoqueID"] + '>D</a>';}}
],
});
}
};
</script>
<div class="linha left" id="grid_lote">
<br />
<br />
<table id="lista_lote" class="display">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="linha left" id="grid_estoque">
<br />
<br />
<table id="lista_estoque" class="display">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
TKS @ ricola3d更換
...無法觀看我的錯誤 –