Error in finding column value in jquery

Posted by Klbaiju under jQuery on 3/7/2014 | Points: 10 | Views : 561 | Status : [Member] | Replies : 2
Hi,
I want to find the column value of gridvie using jquery
my values in column are float values

eg 08:00 and 06:15
iam getting 14 only .i need 14.15

I tried this code
$("tr").each(function () {
if (!$(this).hasClass("Header") && !$(this).hasClass("Footer")) {
var atime = $(this).find(".Atime").text();


totalHr += parseFloat($(this).find(".Atime").text());

}
if ($(this).hasClass("Footer")) {
$(this).empty();
$(this).append("<td colspan='4' align='right'>TOTAL : " + totalHr + "</td>");
}
});

I also tried parseFloat($(this).find(".Atime").val())
but it returns
NaN.
how to solve this

Regards
Baiju




Responses

Posted by: Bandi on: 3/7/2014 [Member] [MVP] Platinum | Points: 25

Up
0
Down
In SQL Server you can do as follows:

declare @Time1 time = '08:00:00', @Time2 TIME = '06:15:00'
SELECT DATEADD(SECOND,DATEDIFF(SECOND,'00:00:00',@Time1),@Time2) AS AddedTime;



Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: kgovindarao523-21772 on: 3/10/2014 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,
Try like this:

$("tr").each(function () { 
if (!$(this).hasClass("Header") && !$(this).hasClass("Footer")) {
var atime = $(this).find(".Atime").text();


totalHr += parseFloat($(this).find(".Atime").text()).toFixed(2) ;

}
if ($(this).hasClass("Footer")) {
$(this).empty();
$(this).append("<td colspan='4' align='right'>TOTAL : " + totalHr + "</td>");
}
});


Thank you,
Govind

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response