我有以下情況:我有一個顯示多個JSON數據表的視圖。目前,我使用@foreach
生成HTML標記,併爲每個JSON數據表使用單獨的jscript函數。動態顯示一個視圖中的多個JSON表
的結果應該是,生成動態的完整視圖:
<div class="content animate-panel">
@{
foreach (var fc in Model)
{
<div class="row">
<div class="col-lg-12">
<div class="hpanel">
<div class="panel-heading">
<div class="panel-tools">
<a class="showhide"><i class="fa fa-chevron-up"></i></a>
<a class="closebox"><i class="fa fa-times"></i></a>
</div>
Auszahlungen @fc.Name
</div>
<div class="panel-body">
<div class="table-responsive">
<table id="[email protected]_ID" class="display table table-bordered" width="100%">
<thead>
<tr>
<th>Datum</th>
<th align="right">Umsatz</th>
<th>Anteil 's Fachl</th>
<th>Rabatt <span style="margin-left: 2px;" class="fa fa-question-circle" title="Hier hat der Fachlmeister auf die 10% Umsatzprovision verzichtet und 10% Rabatt dem Endkunden gegeben."></span></th>
<th>ausbezahlter Betrag</th>
<th>Details/Drucken</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
</div>
</div>
}
}
</div>
腳本:
$(function() {
// JSON data
var chartDataUrl_1 = '@Url.Action("tableJsonDataAbrechnung", "FachlViews", new { fid = "1"})';
// Tabelle für den Standort Wien
$('#FachlID_1').dataTable({
language: {
"zeroRecords": "Keine Daten gefunden",
"lengthMenu": "Zeige _MENU_ Datensätze",
"search": "Suche:",
"paginate": {
"first": "Anfang",
"last": "Ende",
"next": "Weiter",
"previous": "Zurück"
},
},
"ajax": chartDataUrl_1,
dom: "<'row'<'col-sm-4'l><'col-sm-4 text-center'B><'col-sm-4'f>>tp",
"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
buttons: [
//{ extend: 'copy', className: 'btn-sm' },
//{ extend: 'csv', title: 'ExampleFile', className: 'btn-sm' },
//{ extend: 'pdf', title: 'ExampleFile', className: 'btn-sm' },
{ extend: 'print', className: 'btn-sm' }
]
});
誰能幫助我獲得動態相應參數
{ fid = "1" }
到
@fc.Shop_ID
在foreach中。
你解決了你的問題嗎?如果其中一個幫助你,你能否給出答案? – GGO