Formatting
From Daxipedia
Contents |
[edit] Overview
[edit] Description
The formatting function is used to display the data in a specific way where the information can be displyed in a friendly format.
[edit] Calls and Properties
To use the formatting function just 2 parameters needs to be passed.
The formatting will be configured on the resources.js
Eg.
format( type, value )
type: is the formatt selected on the admin section
value: is the data value that will be formatted
[edit] Basic
[edit] .Types of Formatting
There are different types of formatting options as showing below:
[a] Date [b] Number [c] Text/Alpha [d] Boolean [e] Numeric
[edit] Date
The DATE formatting allows the user to display the data in the following formats:
The general formatting for date is yyyd-mm-dd.
- none no formatting
- mm-dd-yyyy: 11-23-2006
- dd-mm-yyyy: 24-12-2006
- dd-mmm-yyyy: 13 Oct, 2006
The date fomatting is defined on the resource.js file. If no formatting is selected "NONE" a default formatting will be selected by getting the first formatting on the right after the NONE formatting on the resources.js file. If there is no ohter formatting option after the NONE on the resources.js file, for TIME and DATE fields, a 4D formatting will be de default one.
Eg1. ["NONE" , "MM-DD-YYYY"] If none is selected on the admin,the formatting MM-DD-YYYY will be the default formatting for this field.
Eg2. ["NONE"] If none is selected the default formatting will be YYYY-MM-DD as 4D formatting.
[edit] Number
The NUMBER formatting is used for ( integer, long integer, real ) fields.
For numbers ( integer, real, longinteger ) the formatting will be defined by the user.
The typ of formattings will be declared on the resources.js file, following the parameters showed below.
The variable is composed of 5 parameters:
1] preFix: any value to be placed before the data. Eg: $, R$, #, etc ) 2] thousand separator: defines if the number will be separated in thousands. Any value is accept . 3] decimal places: defines if the number will have a decimal place at the end. Any value is accept. 4] number of decimal places. (indicaes how many digits after the decimal separator. 2, 3, 4, etc . 5] postFix: any value to be placed after the data. EUR, C, F, etc.
By example to a number to be displayed as: $999,999.99, the parameter will have the folowing formatting:
[edit] "$,cm,per,2,"
[$] prefix [cm] comma separator for thousands [per] period for decimal points [2] number of decimal points [blank] postfix
All the parameters must be passed,otherwise the functionn won't work.
[edit] Text / Alpha
The Text / Alpha formatting is used to display the data in lowercase or in UPPERCASE formatting.
Formatting available:
- lowercase: text in lowercase
- UPPERCASE: TEXT IN UPPERCASE
For these cases the formatting will be displayed just on the GRID, the formatting won't take place on the editor.
[edit] Boolean
The boolean formatting is really useful when the information is 0 or 1 and it can be displayed in TRUE or FALSE formatting or any another specified formatting.
Formatting available:
- True/False
- Vrai/Faux
- Yes/No
- Male/Female
For boolean formattings, the new formatting can be chosen by typing the first letter of the options.
Eg: If the user types "T" or "t" on the True/False formatting the system will formatt to True.
Example usage:
[edit] Technical Details
The formattings must be defined on the resources.js file. The number formatting can be personalized.
After defined the formattings, the disered formatting needs to be selected on the adming when on the web, each field can have it own formatting.
If the grid is open or a detail field is open and the formatting got changed on the admin, the detail field and the grid needs to be closed for the new formatting take place.
The DEFAULT FORMATTING will happen for TIME, DATE and BOOLEAN fields, for the other types if no formatting is provided after the NONE formatting, the string value will have the original value without been formatted.
For the BOOLEAN type the True/False formatting will be the default if NONE is selected.
[edit] How does it work?
The formatting needs to be defined on the admin.
When the table is loaded on grid the data gets the formatting.
If a record is selected to be edited, the data gets the formatting too.
The UPPERCASE and lowercase formatting is applied just on the GRID, the editor shows the original value without any formatting.
