如何使用javascript或jquery将列的值汇总到特定位置? [英] How do I sum the values of columns to a specific position using javascript or jquery?

查看:63
本文介绍了如何使用javascript或jquery将列的值汇总到特定位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我在jquery中有一个表,其中日期为日期选择器的日期和旁边的一个名为Hours的列。我需要一起使用这些来输入特定日期的小时数。现在,我有一个隐藏的字段变量,另一个日期叫做paystartdate。每个付费周都从这个paystartdate开始。此paystartdate和paystartdate + 6周的小时数不应超过40小时。当我尝试将付费周的小时列相加时,它会添加所有行。但我需要总结一周。怎么做。





简单来说,我需要根据该付费周的报告日期,将每周的时间总和相加。

Hello,

I have a table in jquery which has daydate as date from date picker and a column next to that called Hours. I need to use these together to enter hours for that specific date. Now, I've a hidden field variable with another date called paystartdate. Every payweek starts from this paystartdate. And the sum of hours for this paystartdate and paystartdate+6 week shouldn't be more than 40 hrs. When I try to sum the hours column for the payweek it is adding all the rows. But I need to sum up for each week. How to do this.


In simple words I need to sum the hours coloumn for each week on basis of report dates for that payweek.

var _paystartdate = new Date($('[id$=hdnpaystartdate]').val());
           var daydate = new $('[id$=datepicker]').val();
           var _payenddate = new Date(_paystartdate);
           _payenddate.setDate(_paystartdate.getDate() + 6);







if(Date.parse(daydate)> = _paystartdate&& Date.parse(daydate)< = _payenddate)

本周的小时数总和。当我这样做时,我得到整列的总和

推荐答案

' [id
('[id


= hdnpaystartdate]')。val());
var daydate = new
=hdnpaystartdate]').val()); var daydate = new


' [id
('[id


这篇关于如何使用javascript或jquery将列的值汇总到特定位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆