w2utils.formatters

An object with formatting functions.
Object
This object provides formatters for all widgets (especially in the grid). You can extend formatters with your custom formatters: Below is the list of formatters that are already implemented:
  • age - age in human readable format
  • currency - money format
  • date:date_format - date, see w2utils.settings
  • datetime:date_format|time_format - date & time, see w2utils.settings
  • float:XX - formatted number, where XX is number digits after comma
  • gmt - time in GMT
  • int - formatted integer, see w2utils.settings
  • interval - time interval in human readable format
  • money - money format, see w2utils.settings
  • number:XX, - formatted number, where XX is number digits after comma
  • password - password ****
  • percent - formatted percent
  • size, - file size in human readable format
  • time:time_format, - time, see w2utils.settings
  • timestamp - timestamp, see w2utils.settings
  • toggle - yes/no text
You can use them in grid when you define columns in the following way: Note that you can pass params after pipe (|).

User Comments

comments powered by Disqus