calculate
calculate
wuestl
Posts: 13Questions: 0Answers: 0
Hi Allan,
i would like to show a calculation between two rows in the datatabel.
I have been testet it with mRender but my Problem ther is that with + it did not make a sum.
My Code is
"mData": "stunden",
"mRender": function ( val, type, row ) {
if ( val ) {
return (((val*60)+row.minuten)/60);
return addCommas(val, '.', ',');
}
return "";
},
"sDefaultContent": ""
when we use as example for val=1 and for row.minuten=30 then there have to be as result 1.5 but the result is now 100.5
Also i would like to replace the . with a ,
Thanks for your help
Oliver
i would like to show a calculation between two rows in the datatabel.
I have been testet it with mRender but my Problem ther is that with + it did not make a sum.
My Code is
"mData": "stunden",
"mRender": function ( val, type, row ) {
if ( val ) {
return (((val*60)+row.minuten)/60);
return addCommas(val, '.', ',');
}
return "";
},
"sDefaultContent": ""
when we use as example for val=1 and for row.minuten=30 then there have to be as result 1.5 but the result is now 100.5
Also i would like to replace the . with a ,
Thanks for your help
Oliver
This discussion has been closed.
Replies
"mData": "stunden",
"mRender": function ( val, type, row ) {
if ( val ) {
zeit = val*60;
zeit = zeit*1 + row.minuten*1;
zeit = zeit/60;
}
return zeit;
},
But i cant find how i can replace the . with ,
zeit.replace(".",",");
did not work.
Thanks
Oliver
Allan
Do you have an example for me, please?
I dont know where i have to set +''
Best Regards
Oliver
var i = 60.3;
i = i+'';
i.replace( '.', ',' );
[/code]
You can use `toString()` as well I think. MDN will have more information about general Javascript stuff: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toString
Allan
Thank you so much for your help and your patience with me ;)
Best Regards
Oliver