का उपयोग कर योग्य डेटा मैं डेटा तालिका का उपयोग कर रहा हूं। मैं कुछ कॉलमों का योग करना चाहता हूं और मैं रिपोर्ट के नीचे दिखाना चाहता हूं। मैं कई चीजें खोजता हूं। फिर मुझे डेटा तालिका में नया पाद लेख कॉलबैक फ़ंक्शन मिला। मैंने इसका इस्तेमाल किया। लेकिन फिर भी मेरी उत्पादन अभी तक तैयार नहीं मेरे कोड इस प्रकार, है ..डेटा में कुछ पंक्तियों का योग कैसे करें footercallback
function Databind(Pdestroy) {debugger;
var destroy = false;
if (Pdestroy == "1")
destroy = true;
var oTable = $('.datatable').dataTable({
"bJQueryUI": true,
'bServerSide': true,
"bDestroy": destroy,
"iDisplayLength": 10,
"sPaginationType": "full_numbers",
'sAjaxSource': '<%= Url.Action("listcount", "Home") %>',
"bFilter": true,
"aoColumnDefs": [{ 'bSortable': false, 'aTargets': [0, 1, 2, 7, 8, 9, 10, 11]}],
"fnRowCallback": function (nRow, aData, iDisplayIndex) {
var oSettings = oTable.fnSettings();
$("td:first", nRow).html(oSettings._iDisplayStart + iDisplayIndex + 1);
return nRow;
},
"footerCallback": function (row, aData, start, end, iDisplayIndex) {
var api = this.api(),
data;
// Remove the formatting to get integer data for summation
var intVal = function (i) {
return typeof i === 'string' ? i.replace(/[\$,]/g, '') * 1 : typeof i === 'number' ? i : 0;
};
// Total over all pages
total = api.column(4)
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
});
// Total over this page
pageTotal = api.column(4, {
page: 'current'
})
.data()
.reduce(function (a, b) {
return intVal(a) + intVal(b);
}, 0);
// Update footer
$(api.column(5).footer()).html(
'$' + pageTotal + ' ($' + total + ' total)');
}
});
}
यहाँ दिखा रहा है undefined.And भी कोई त्रुटि दिखाई दे रहा। लेकिन आउटपुट नहीं दिख रहा है। मैं उत्पादन के स्क्रीनशॉट ..
मूल्यों मैं क्या आगे की प्रक्रिया क्या करना चाहिए प्राप्त करने के लिए संलग्न है?
एनसील्स [1] .innerHTML = parseInt (iTarget) दिखा रहा है; 'अपरिभाषित' – PoliDev
के आंतरिक आंतरिक HTML सेट नहीं कर सकते हैं संभावित कारण हैं 1. आपने tfoot 2 को परिभाषित नहीं किया है। आपने टीफुट के अंदर वें परिभाषित नहीं किया है। @PoliDev –