File tree Expand file tree Collapse file tree
tutorials/hcpps-sapui5-ps-forecast-synchronous/predictive/webapp/model Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ sap . ui . define ( [
2+ "sap/ui/core/format/NumberFormat"
3+ ] , function ( ) {
4+ "use strict" ;
5+ var isNumeric = function ( oValue ) {
6+ var tmp = oValue && oValue . toString ( ) ;
7+ return ! jQuery . isArray ( oValue ) && ( tmp - parseFloat ( tmp ) + 1 ) >= 0 ;
8+ } ;
9+ jQuery . sap . require ( "sap.ui.core.format.NumberFormat" ) ;
10+ var oNumberFormat = sap . ui . core . format . NumberFormat . getFloatInstance ( {
11+ maxFractionDigits : 2 ,
12+ groupingEnabled : true ,
13+ groupingSeparator : "," ,
14+ decimalSeparator : "."
15+ } , sap . ui . getCore ( ) . getConfiguration ( ) . getLocale ( ) ) ;
16+
17+ var round = function ( value , decimal ) {
18+ if ( value !== 'undefined' && isNumeric ( value ) ) {
19+ // return Number(value).toFixed(decimal);
20+ return oNumberFormat . format ( value ) ;
21+ } else {
22+ return "nothing" ;
23+ }
24+ } ;
25+ return {
26+ round : function ( value ) {
27+ return round ( value ) ;
28+ }
29+ } ;
30+ } ) ;
You can’t perform that action at this time.
0 commit comments