DayTripper Posted December 11, 2017 Share Posted December 11, 2017 Hi all, Does anyone know is there a way to format numeric values on mobile DBGrid. Normal uniDBGrid can do it in renderer function, what about mobile DBGrid? Than you. Best regards, Simon Quote Link to comment Share on other sites More sharing options...
Sherzod Posted December 11, 2017 Share Posted December 11, 2017 Hi, Which edition and build are you using ?! Best regards, Quote Link to comment Share on other sites More sharing options...
DayTripper Posted December 11, 2017 Author Share Posted December 11, 2017 Hi, uniGUI Complete Trial Edition 1.0.0 Build 1421 Best regards, Simon Quote Link to comment Share on other sites More sharing options...
pedrisco Posted February 22, 2018 Share Posted February 22, 2018 Hi I've found the same issue... The quick way is write the onGetText event for every field. procedure TForm1.numberFieldGetText(Sender: TField; var Text: string; DisplayText: Boolean);begin text := formatFloat( TNumericField( sender ).DisplayFormat , sender.value );end; But if you have uniDBUtils.pas and you feel brave, you can touch the "numbers" section in the FieldValueToJS function: ... ftCurrency: begin if f.InheritsFrom( TNumericField ) and (TNumericField( f ).DisplayFormat<>'') then try result := '"'+formatFloat( TNumericField( f ).DisplayFormat , f.value )+'"'; except Result := F.Value; // important: here we must use Delphi's {FormatSettings}.DecimalSeparator, becuase "F.Value" internally uses it to convert value to string. Result:=UniStringReplace(Result, {$ifdef COMPILER_15_UP}SysUtils.FormatSettings.{$endif}DecimalSeparator, '.'); end else begin Result := F.Value; // important: here we must use Delphi's {FormatSettings}.DecimalSeparator, becuase "F.Value" internally uses it to convert value to string. Result:=UniStringReplace(Result, {$ifdef COMPILER_15_UP}SysUtils.FormatSettings.{$endif}DecimalSeparator, '.'); end; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 23, 2018 Share Posted February 23, 2018 Hello, But if you have uniDBUtils.pas and you feel brave, you can touch the "numbers" section in the FieldValueToJS function: ... ftCurrency: begin if f.InheritsFrom( TNumericField ) and (TNumericField( f ).DisplayFormat<>'') then try result := '"'+formatFloat( TNumericField( f ).DisplayFormat , f.value )+'"'; except Result := F.Value; // important: here we must use Delphi's {FormatSettings}.DecimalSeparator, becuase "F.Value" internally uses it to convert value to string. Result:=UniStringReplace(Result, {$ifdef COMPILER_15_UP}SysUtils.FormatSettings.{$endif}DecimalSeparator, '.'); end else begin Result := F.Value; // important: here we must use Delphi's {FormatSettings}.DecimalSeparator, becuase "F.Value" internally uses it to convert value to string. Result:=UniStringReplace(Result, {$ifdef COMPILER_15_UP}SysUtils.FormatSettings.{$endif}DecimalSeparator, '.'); end; end; Which editon are you using ?! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.