var Jdata = [{"Store":480,"District":62,"Region":8,"Area":10,"City":"SPRINGFIELD","State":"TN","RiskClass":"RISK CLASS 2","AssignedDate":null,"AssignedBy":null,"AssignedConfig":null,"MatchCount":0,"MismatchCount":0,"ConfigModDate":null,"ConfigAppliedDate":null,"ConfigModBy":null},{"Store":590,"District":62,"Region":8,"Area":10,"City":"ASHLAND CITY","State":"TN","RiskClass":"RISK CLASS 0","AssignedDate":null,"AssignedBy":null,"AssignedConfig":null,"MatchCount":0,"MismatchCount":0,"ConfigModDate":null,"ConfigAppliedDate":null,"ConfigModBy":null}] var tableCatValue = $('#AjaxGrid').dataTable({ "bDestroy": true, "bFilter": true, "pageLength": 5, "bLengthChange": false, "data": Jdata, "columns": [ { data: null, render: function (data, type, row) { return '<div class=" messageName ">' + data.Store + '</div>'; }, width: '20%' }, { data: null, render: function (data, type, row) { return '<div class=" messageDesc">' + data.District + '</div>'; }, width: '53%' }, { data: null, render: function (data, type, row) { return '<div class=" messageName ct-ml-10">' + data.Region + '</div>'; }, width: '20%' }, { data: null, render: function (data, type, row) { return '<div class=" messageName ct-ml-10">' + data.Area + '</div>'; }, width: '20%' } ] });
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <table id="AjaxGrid"> <thead> \t <tr> \t \t <th> \t \t \t <b>Group</b> \t \t </th> \t \t <th> \t \t \t <b>Region</b> \t \t </th> \t \t <th> \t \t \t <b>District</b> \t \t </th> \t \t <th> \t \t \t <b>Store</b> \t \t </th> \t </tr> </thead> <tbody> </tbody> </table>
-1
A
回答
0
問題1:首先加載jquery
,然後加載dataTable
。
Problem2:您還沒有包括dataTable.css(樣式表)
var Jdata = [{"Store":480,"District":62,"Region":8,"Area":10,"City":"SPRINGFIELD","State":"TN","RiskClass":"RISK CLASS 2","AssignedDate":null,"AssignedBy":null,"AssignedConfig":null,"MatchCount":0,"MismatchCount":0,"ConfigModDate":null,"ConfigAppliedDate":null,"ConfigModBy":null},{"Store":590,"District":62,"Region":8,"Area":10,"City":"ASHLAND CITY","State":"TN","RiskClass":"RISK CLASS 0","AssignedDate":null,"AssignedBy":null,"AssignedConfig":null,"MatchCount":0,"MismatchCount":0,"ConfigModDate":null,"ConfigAppliedDate":null,"ConfigModBy":null}];
var tableCatValue = $('#AjaxGrid').dataTable({
"bDestroy": true,
"bFilter": true,
"pageLength": 5,
"bLengthChange": false,
"data": Jdata,
"columns": [
{ data: null, render: function (data, type, row) {
return '<div class=" messageName ">' + data.Store + '</div>';
}, width: '20%'
},
{ data: null, render: function (data, type, row) {
return '<div class=" messageDesc">' + data.District + '</div>';
}, width: '53%'
},
{ data: null, render: function (data, type, row) {
return '<div class=" messageName ct-ml-10">' + data.Region + '</div>';
}, width: '20%'
},
{ data: null, render: function (data, type, row) {
return '<div class=" messageName ct-ml-10">' + data.Area + '</div>';
}, width: '20%'
}
]
});
<link href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
<table id="AjaxGrid">
<thead>
\t <tr>
\t \t <th>
\t \t \t <b>Group</b>
\t \t </th>
\t \t <th>
\t \t \t <b>Region</b>
\t \t </th>
\t \t <th>
\t \t \t <b>District</b>
\t \t </th>
\t \t <th>
\t \t \t <b>Store</b>
\t \t </th>
\t </tr>
</thead>
<tbody>
</tbody>
</table>
+0
謝謝你完美...! –
+0
@vasanthnaidu如果它解決了您的問題,請接受回答 –
+0
還有一件事,比如說如何提高績效,因爲我們擁有7000多條記錄。 –
相關問題
- 1. Knockout Json數據綁定問題
- 2. 使用jQuery綁定JSON數據的DataTable從服務器
- 3. Json請求數據和jQuery的prettyphoto綁定問題
- 4. JSON數據jQuery dataTable在web2py
- 5. jQuery DataTable - 動態綁定複選框列與服務器數據
- 6. datatable綁定到datagridview的問題
- 7. jQuery綁定問題
- 8. UltraChart數據綁定問題
- 9. 行數據綁定問題
- 10. LongListSelector數據綁定問題
- 11. 數據集綁定問題
- 12. C#數據綁定問題
- 13. Flex數據綁定問題
- 14. listview數據綁定問題
- 15. 數據綁定問題
- 16. WPF數據綁定問題
- 17. Silverlight數據綁定問題
- 18. GridView數據綁定問題
- 19. 數據綁定問題
- 20. WPF數據綁定問題
- 21. JSF2數據綁定問題
- 22. 數據綁定問題
- 23. WPF - 數據綁定問題
- 24. WPF數據綁定問題
- 25. NSTextView「數據」綁定問題
- 26. WPF數據綁定問題
- 27. WPF數據綁定問題
- 28. WPF數據綁定問題
- 29. Silverlight數據綁定問題 - 不與POCO綁定 - Visifire
- 30. 與web服務jQuery DataTable和服務器端數據問題
具體是什麼問題,問題嗎?請花幾分鐘時間閱讀[問] – charlietfl
數據未加載到表中。 –
而且您可能在瀏覽器控制檯中出現錯誤...您看起來了嗎? – charlietfl