Ext.data.JsonP.Ext_util_Format({"mixins":[],"code_type":"nop","inheritable":false,"component":false,"meta":{},"mixedInto":[],"uses":[],"aliases":{},"parentMixins":[],"superclasses":[],"members":{"event":[],"property":[{"meta":{},"owner":"Ext.util.Format","tagname":"property","name":"currencyAtEnd","id":"property-currencyAtEnd"},{"meta":{},"owner":"Ext.util.Format","tagname":"property","name":"currencyPrecision","id":"property-currencyPrecision"},{"meta":{},"owner":"Ext.util.Format","tagname":"property","name":"currencySign","id":"property-currencySign"},{"meta":{},"owner":"Ext.util.Format","tagname":"property","name":"decimalSeparator","id":"property-decimalSeparator"},{"meta":{},"owner":"Ext.util.Format","tagname":"property","name":"thousandSeparator","id":"property-thousandSeparator"}],"css_var":[],"method":[{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"capitalize","id":"method-capitalize"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"currency","id":"method-currency"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"date","id":"method-date"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"dateRenderer","id":"method-dateRenderer"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"defaultValue","id":"method-defaultValue"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"ellipsis","id":"method-ellipsis"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"escapeRegex","id":"method-escapeRegex"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"fileSize","id":"method-fileSize"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"format","id":"method-format"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"htmlDecode","id":"method-htmlDecode"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"htmlEncode","id":"method-htmlEncode"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"leftPad","id":"method-leftPad"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"lowercase","id":"method-lowercase"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"math","id":"method-math"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"nl2br","id":"method-nl2br"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"number","id":"method-number"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"numberRenderer","id":"method-numberRenderer"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"parseBox","id":"method-parseBox"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"plural","id":"method-plural"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"round","id":"method-round"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"stripScripts","id":"method-stripScripts"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"stripTags","id":"method-stripTags"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"substr","id":"method-substr"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"trim","id":"method-trim"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"undef","id":"method-undef"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"uppercase","id":"method-uppercase"},{"meta":{},"owner":"Ext.util.Format","tagname":"method","name":"usMoney","id":"method-usMoney"}],"css_mixin":[],"cfg":[]},"tagname":"class","extends":null,"html":"

Files

This class is a centralized place for formatting functions. It includes\nfunctions to format various different types of data, such as text, dates and numeric values.

\n\n

Localization

\n\n

This class contains several options for localization. These can be set once the library has loaded,\nall calls to the functions from that point will use the locale settings that were specified.

\n\n

Options include:

\n\n\n\n\n

This class also uses the default date format defined here: Ext.Date.defaultFormat.

\n\n

Using with renderers

\n\n

There are two helper functions that return a new function that can be used in conjunction with\ngrid renderers:

\n\n
columns: [{\n    dataIndex: 'date',\n    renderer: Ext.util.Format.dateRenderer('Y-m-d')\n}, {\n    dataIndex: 'time',\n    renderer: Ext.util.Format.numberRenderer('0.000')\n}]\n
\n\n

Functions that only take a single argument can also be passed directly:

\n\n
columns: [{\n    dataIndex: 'cost',\n    renderer: Ext.util.Format.usMoney\n}, {\n    dataIndex: 'productCode',\n    renderer: Ext.util.Format.uppercase\n}]\n
\n\n

Using with XTemplates

\n\n

XTemplates can also directly use Ext.util.Format functions:

\n\n
new Ext.XTemplate([\n    'Date: {startDate:date(\"Y-m-d\")}',\n    'Cost: {cost:usMoney}'\n]);\n
\n
Defined By

Properties

This may be set to true to make the currency function\nappend the currency sign to the formatted value. ...

This may be set to true to make the currency function\nappend the currency sign to the formatted value.

\n\n

This may be overridden in a locale file.

\n

Defaults to: false

The number of decimal places that the currency function displays. ...

The number of decimal places that the currency function displays.

\n\n

This may be overridden in a locale file.

\n

Defaults to: 2

The currency sign that the currency function displays. ...

The currency sign that the currency function displays.

\n\n

This may be overridden in a locale file.

\n

Defaults to: "$"

The character that the number function uses as a decimal point. ...

The character that the number function uses as a decimal point.

\n\n

This may be overridden in a locale file.

\n

Defaults to: "."

The character that the number function uses as a thousand separator. ...

The character that the number function uses as a thousand separator.

\n\n

This may be overridden in a locale file.

\n

Defaults to: ","

Defined By

Methods

Ext.util.Format
view source
( String string ) : String
Alias for Ext.String.capitalize. ...

Alias for Ext.String.capitalize.

\n\n

Capitalize the given string

\n

Parameters

Returns

Ext.util.Format
view source
( Number/String value, [String sign], [Number decimals], [Boolean end] ) : String
Format a number as a currency. ...

Format a number as a currency.

\n

Parameters

Returns

  • String

    The formatted currency string

    \n
Ext.util.Format
view source
( String/Date value, [String format] ) : String
Formats the passed date using the specified format pattern. ...

Formats the passed date using the specified format pattern.

\n

Parameters

Returns

  • String

    The formatted date string.

    \n
Ext.util.Format
view source
( String format ) : Function
Returns a date rendering function that can be reused to apply a date format multiple times efficiently. ...

Returns a date rendering function that can be reused to apply a date format multiple times efficiently.

\n

Parameters

Returns

Ext.util.Format
view source
( Object value, [String defaultValue] ) : String
Checks a reference and converts it to the default value if it's empty. ...

Checks a reference and converts it to the default value if it's empty.

\n

Parameters

  • value : Object

    Reference to check

    \n
  • defaultValue : String (optional)

    The value to insert of it's undefined.

    \n

    Defaults to: ""

Returns

Ext.util.Format
view source
( String value, Number length, Boolean word ) : String
Alias for Ext.String.ellipsis. ...

Alias for Ext.String.ellipsis.

\n\n

Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length

\n

Parameters

  • value : String

    The string to truncate

    \n
  • length : Number

    The maximum length to allow before truncating

    \n
  • word : Boolean

    True to try to find a common word break

    \n

Returns

Ext.util.Format
view source
( String str ) : String
Escapes the passed string for use in a regular expression. ...

Escapes the passed string for use in a regular expression.

\n

Parameters

Returns

Ext.util.Format
view source
( Number/String size ) : String
Simple format for a file size (xxx bytes, xxx KB, xxx MB). ...

Simple format for a file size (xxx bytes, xxx KB, xxx MB).

\n

Parameters

Returns

  • String

    The formatted file size

    \n
Ext.util.Format
view source
( String string, String value1, String value2 ) : String
Alias for Ext.String.format. ...

Alias for Ext.String.format.

\n\n

Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each\ntoken must be unique, and must increment in the format {0}, {1}, etc. Example usage:

\n\n
    var cls = 'my-class', text = 'Some text';\n    var s = Ext.String.format('<div class=\"{0}\">{1}</div>', cls, text);\n    // s now contains the string: '<div class=\"my-class\">Some text</div>'\n           
\n\n

Parameters

  • string : String

    The tokenized string to be formatted

    \n
  • value1 : String

    The value to replace token {0}

    \n
  • value2 : String

    Etc...

    \n

Returns

Ext.util.Format
view source
( String value ) : String
Alias for Ext.String.htmlDecode. ...

Alias for Ext.String.htmlDecode.

\n\n

Convert certain characters (&, <, >, ', and \") from their HTML character equivalents.

\n

Parameters

  • value : String

    The string to decode

    \n

Returns

Ext.util.Format
view source
( String value ) : String
Alias for Ext.String.htmlEncode. ...

Alias for Ext.String.htmlEncode.

\n\n

Convert certain characters (&, <, >, ', and \") to their HTML character equivalents for literal display in web pages.

\n

Parameters

  • value : String

    The string to encode

    \n

Returns

Ext.util.Format
view source
( String string, Number size, [String character] ) : String
Alias for Ext.String.leftPad. ...

Alias for Ext.String.leftPad.

\n\n

Pads the left side of a string with a specified character. This is especially useful\nfor normalizing number and date strings. Example usage:

\n\n
    var s = Ext.String.leftPad('123', 5, '0');\n    // s now contains the string: '00123'\n           
\n\n

Parameters

  • string : String

    The original string

    \n
  • size : Number

    The total length of the output string

    \n
  • character : String (optional)

    The character with which to pad the original string (defaults to empty string \" \")

    \n

Returns

Ext.util.Format
view source
( String value ) : String
Converts a string to all lower case letters. ...

Converts a string to all lower case letters.

\n

Parameters

  • value : String

    The text to convert

    \n

Returns

Ext.util.Format
view source
( ) : Function
It does simple math for use in a template, for example:\n\nvar tpl = new Ext.Template('{value} * 10 = {value:math(\"* 10...

It does simple math for use in a template, for example:

\n\n
var tpl = new Ext.Template('{value} * 10 = {value:math(\"* 10\")}');\n
\n

Returns

  • Function

    A function that operates on the passed value.

    \n
Ext.util.Format
view source
( String The ) : String
Converts newline characters to the HTML tag <br/> ...

Converts newline characters to the HTML tag <br/>

\n

Parameters

  • The : String

    string value to format.

    \n

Returns

  • String

    The string with embedded <br/> tags in place of newlines.

    \n
Ext.util.Format
view source
( Number v, String format ) : String
Formats the passed number according to the passed format string. ...

Formats the passed number according to the passed format string.

\n\n

The number of digits after the decimal separator character specifies the number of\ndecimal places in the resulting string. The local-specific decimal character is\nused in the result.

\n\n

The presence of a thousand separator character in the format string specifies that\nthe locale-specific thousand separator (if any) is inserted separating thousand groups.

\n\n

By default, \",\" is expected as the thousand separator, and \".\" is expected as the decimal separator.

\n\n

New to Ext JS 4

\n\n

Locale-specific characters are always used in the formatted output when inserting\nthousand and decimal separators.

\n\n

The format string must specify separator characters according to US/UK conventions (\",\" as the\nthousand separator, and \".\" as the decimal separator)

\n\n

To allow specification of format strings according to local conventions for separator characters, add\nthe string /i to the end of the format string.

\n\n

examples (123456.789):

\n\n
    \n
  • 0 - (123456) show only digits, no precision
  • \n
  • 0.00 - (123456.78) show only digits, 2 precision
  • \n
  • 0.0000 - (123456.7890) show only digits, 4 precision
  • \n
  • 0,000 - (123,456) show comma and digits, no precision
  • \n
  • 0,000.00 - (123,456.78) show comma and digits, 2 precision
  • \n
  • 0,0.00 - (123,456.78) shortcut method, show comma and digits, 2 precision
  • \n
\n\n\n

To allow specification of the formatting string using UK/US grouping characters (,) and\ndecimal (.) for international numbers, add /i to the end. For example: 0.000,00/i

\n

Parameters

  • v : Number

    The number to format.

    \n
  • format : String

    The way you would like to format this text.

    \n

Returns

Ext.util.Format
view source
( String format ) : Function
Returns a number rendering function that can be reused to apply a number format multiple\ntimes efficiently. ...

Returns a number rendering function that can be reused to apply a number format multiple\ntimes efficiently.

\n

Parameters

Returns

  • Function

    The number formatting function

    \n
Ext.util.Format
view source
( Number/String v ) : Object
Parses a number or string representing margin sizes into an object. ...

Parses a number or string representing margin sizes into an object.\nSupports CSS-style margin declarations (e.g. 10, \"10\", \"10 10\", \"10 10 10\" and\n\"10 10 10 10\" are all valid options and would return the same result).

\n

Parameters

Returns

  • Object

    An object with margin sizes for top, right, bottom and left

    \n
Ext.util.Format
view source
( Number value, String singular, [String plural] )
Selectively do a plural form of a word based on a numeric value. ...

Selectively do a plural form of a word based on a numeric value. For example, in a template,\n{commentCount:plural(\"Comment\")} would result in \"1 Comment\" if commentCount was 1 or\nwould be \"x Comments\" if the value is 0 or greater than 1.

\n

Parameters

  • value : Number

    The value to compare against

    \n
  • singular : String

    The singular form of the word

    \n
  • plural : String (optional)

    The plural form of the word (defaults to the singular with an \"s\")

    \n
Ext.util.Format
view source
( Number/String value, Number precision ) : Number
Rounds the passed number to the required decimal precision. ...

Rounds the passed number to the required decimal precision.

\n

Parameters

  • value : Number/String

    The numeric value to round.

    \n
  • precision : Number

    The number of decimal places to which to round the first parameter's value.

    \n

Returns

Ext.util.Format
view source
( Object value ) : String
Strips all script tags. ...

Strips all script tags.

\n

Parameters

  • value : Object

    The text from which to strip script tags

    \n

Returns

Ext.util.Format
view source
( Object value ) : String
Strips all HTML tags. ...

Strips all HTML tags.

\n

Parameters

  • value : Object

    The text from which to strip tags

    \n

Returns

Ext.util.Format
view source
( String value, Number start, Number length ) : String
Returns a substring from within an original string. ...

Returns a substring from within an original string.

\n

Parameters

  • value : String

    The original text

    \n
  • start : Number

    The start index of the substring

    \n
  • length : Number

    The length of the substring

    \n

Returns

Ext.util.Format
view source
( String string ) : String
Alias for Ext.String.trim. ...

Alias for Ext.String.trim.

\n\n

Trims whitespace from either end of a string, leaving spaces within the string intact. Example:\n@example

\n\n
var s = '  foo bar  ';\nalert('-' + s + '-');         //alerts \"- foo bar -\"\nalert('-' + Ext.String.trim(s) + '-');  //alerts \"-foo bar-\"\n
\n

Parameters

  • string : String

    The string to escape

    \n

Returns

Ext.util.Format
view source
( Object value ) : Object
Checks a reference and converts it to empty string if it is undefined. ...

Checks a reference and converts it to empty string if it is undefined.

\n

Parameters

  • value : Object

    Reference to check

    \n

Returns

  • Object

    Empty string if converted, otherwise the original value

    \n
Ext.util.Format
view source
( String value ) : String
Converts a string to all upper case letters. ...

Converts a string to all upper case letters.

\n

Parameters

  • value : String

    The text to convert

    \n

Returns

Ext.util.Format
view source
( Number/String value ) : String
Format a number as US currency. ...

Format a number as US currency.

\n

Parameters

Returns

  • String

    The formatted currency string

    \n
","subclasses":[],"name":"Ext.util.Format","alternateClassNames":[],"inheritdoc":null,"files":[{"href":"Format.html#Ext-util-Format","filename":"Format.js"}],"html_meta":{},"singleton":true,"id":"class-Ext.util.Format","statics":{"property":[],"event":[],"css_var":[],"method":[],"css_mixin":[],"cfg":[]},"requires":[]});