如何在webgrid页脚中显示行总和 [英] How to display sum of rows in webgrid footer
问题描述
亲爱的朋友们,
我需要用行总和显示webgrid的页脚。我试过但它显示'NaN',另一个问题是当我添加行然后它在页脚后添加行。
< br $>
随着问候,
Vivek .R
我的尝试:
Javascript:
< script type =text / javascript>
$(document).ready(function (){
var total = 0;
$(。Total)。each(function(){
total = total + parseFloat($(this)[0] .innerHTML.toLocaleString());
});
$('tbody')。append(' Total '+ total.toFixed(2)+'');
});
< / script>
Dear friends,
I need to display the footer of webgrid with sum of rows. i have tried but it displays 'NaN' and another problem is when i add the row then it add rows after footer.
With Regards,
Vivek .R
What I have tried:
Javascript:
<script type="text/javascript">
$(document).ready(function () {
var total = 0;
$(".Total").each(function () {
total = total + parseFloat($(this)[0].innerHTML.toLocaleString());
});
$('tbody').append('Total' + total.toFixed(2) + '');
});
</script>
推荐答案
(document).ready(function(){
var total = 0;
(document).ready(function () {
var total = 0;
(。Total)。each(function(){
total = total + parseFloat(
(".Total").each(function () {
total = total + parseFloat(
(this)[0] .innerHTML.toLocaleString());
});
(this)[0].innerHTML.toLocaleString());
});
这篇关于如何在webgrid页脚中显示行总和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!