class type t =object
..end
method currencyAtEnd : bool Js.t Js.prop
This may be set to true
to make the currency function
append the currency sign to the formatted value.
This may be overridden in a locale file.
Defaults to: false
method currencyPrecision : Js.number Js.t Js.prop
The number of decimal places that the currency function displays.
This may be overridden in a locale file.
Defaults to: 2
method currencySign : Js.js_string Js.t Js.prop
The currency sign that the currency function displays.
This may be overridden in a locale file.
Defaults to: '$'
method decimalSeparator : Js.js_string Js.t Js.prop
The character that the number function uses as a decimal point.
This may be overridden in a locale file.
Defaults to: '.'
method thousandSeparator : Js.js_string Js.t Js.prop
The character that the number function uses as a thousand separator.
This may be overridden in a locale file.
Defaults to: ','
method attributes : 'a. 'a Js.t -> unit Js.meth
Formats an object of name value properties as HTML element attribute values suitable for using when creating textual markup.
Parameters:
_ Js.t
An object containing the HTML attributes as properties eg: {height:40, vAlign:'top'}
method capitalize : Js.js_string Js.t -> Js.js_string Js.t Js.meth
method currency : 'b.
'b Js.t ->
Js.js_string Js.t Js.optdef ->
Js.number Js.t Js.optdef ->
bool Js.t Js.optdef -> Js.js_string Js.t Js.meth
Format a number as a currency.
Parameters:
_ Js.t
The numeric value to format
Js.js_string Js.t
(optional)
The currency sign to use (defaults to currencySign)
Js.number Js.t
(optional)
The number of decimals to use for the currency (defaults to currencyPrecision)
bool Js.t
(optional)
True if the currency sign should be at the end of the string (defaults to currencyAtEnd)
Returns:
Js.js_string Js.t
The formatted currency string
method date : 'c. 'c Js.t -> Js.js_string Js.t Js.optdef -> Js.js_string Js.t Js.meth
Formats the passed date using the specified format pattern.
Parameters:
_ Js.t
The value to format. If a string is passed, it is converted to a Date by the Javascript's built-in Date#parse method.
Js.js_string Js.t
(optional)
Any valid date format string. Defaults to Ext.Date.defaultFormat.
Returns:
Js.js_string Js.t
The formatted date string.
method dateRenderer : 'd. Js.js_string Js.t -> 'd Js.callback Js.meth
Returns a date rendering function that can be reused to apply a date format multiple times efficiently.
Parameters:
Js.js_string Js.t
Any valid date format string. Defaults to Ext.Date.defaultFormat.
Returns:
_ Js.callback
The date formatting function
method defaultValue : 'e. 'e Js.t -> Js.js_string Js.t Js.optdef -> Js.js_string Js.t Js.meth
Checks a reference and converts it to the default value if it's empty.
Parameters:
_ Js.t
Reference to check
Js.js_string Js.t
(optional)
The value to insert of it's undefined.
Defaults to: ""method ellipsis : Js.js_string Js.t ->
Js.number Js.t -> bool Js.t Js.optdef -> Js.js_string Js.t Js.meth
Alias for Ext.String.ellipsis.
Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length.
Parameters:
Js.js_string Js.t
The string to truncate.
Js.number Js.t
The maximum length to allow before truncating.
bool Js.t
(optional)
true
to try to find a common word break.
Returns:
Js.js_string Js.t
The converted text.
method escapeRegex : Js.js_string Js.t -> Js.js_string Js.t Js.meth
Escapes the passed string for use in a regular expression.
Parameters:
Js.js_string Js.t
method fileSize : 'f. 'f Js.t -> Js.js_string Js.t Js.meth
Simple format for a file size (xxx bytes, xxx KB, xxx MB).
Parameters:
_ Js.t
The numeric value to format
Returns:
Js.js_string Js.t
The formatted file size
method format : 'g. Js.js_string Js.t -> 'g Js.t -> Js.js_string Js.t Js.meth
Alias for Ext.String.format.
Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens. Each token must be unique, and must increment in the format {0}, {1}, etc. Example usage:
var cls = 'my-class',
text = 'Some text';
var s = Ext.String.format('<div class="{0}">{1}</div>', cls, text);
// s now contains the string: '<div class="my-class">Some text</div>'
Parameters:
Js.js_string Js.t
The tokenized string to be formatted.
_ Js.t
The values to replace tokens {0}
, {1}
, etc in order.
Returns:
Js.js_string Js.t
The formatted string.
method htmlDecode : Js.js_string Js.t -> Js.js_string Js.t Js.meth
Alias for Ext.String.htmlDecode.
Convert certain characters (&, <, >, ', and ") from their HTML character equivalents.
Parameters:
Js.js_string Js.t
The string to decode.
Returns:
Js.js_string Js.t
The decoded text.
method htmlEncode : Js.js_string Js.t -> Js.js_string Js.t Js.meth
Alias for Ext.String.htmlEncode.
Convert certain characters (&, <, >, ', and ") to their HTML character equivalents for literal display in web pages.
Parameters:
Js.js_string Js.t
The string to encode.
Returns:
Js.js_string Js.t
The encoded text.
method leftPad : Js.js_string Js.t ->
Js.number Js.t -> Js.js_string Js.t Js.optdef -> Js.js_string Js.t Js.meth
Alias for Ext.String.leftPad.
Pads the left side of a string with a specified character. This is especially useful for normalizing number and date strings. Example usage:
var s = Ext.String.leftPad('123', 5, '0');
// s now contains the string: '00123'
Parameters:
Js.js_string Js.t
The original string.
Js.number Js.t
The total length of the output string.
Js.js_string Js.t
(optional)
The character with which to pad the original string.
Defaults to: ' 'Returns:
Js.js_string Js.t
The padded string.
method lowercase : Js.js_string Js.t -> Js.js_string Js.t Js.meth
Converts a string to all lower case letters.
Parameters:
Js.js_string Js.t
The text to convert
Returns:
Js.js_string Js.t
The converted text
method math : 'h. 'h Js.callback Js.meth
It does simple math for use in a template, for example:
var tpl = new Ext.Template('{value} * 10 = {value:math("* 10")}');
Returns:
_ Js.callback
A function that operates on the passed value.
method nl2br : Js.js_string Js.t -> Js.js_string Js.t Js.meth
Converts newline characters to the HTML tag <br/>
Parameters:
Js.js_string Js.t
The string value to format.
Returns:
Js.js_string Js.t
The string with embedded <br/>
tags in place of newlines.
method number : Js.number Js.t -> Js.js_string Js.t -> Js.js_string Js.t Js.meth
Formats the passed number according to the passed format string.
The number of digits after the decimal separator character specifies the number of decimal places in the resulting string. The local-specific decimal character is used in the result.
The presence of a thousand separator character in the format string specifies that the locale-specific thousand separator (if any) is inserted separating thousand groups.
By default, "," is expected as the thousand separator, and "." is expected as the decimal separator.
Locale-specific characters are always used in the formatted output when inserting thousand and decimal separators.
The format string must specify separator characters according to US/UK conventions ("," as the thousand separator, and "." as the decimal separator)
To allow specification of format strings according to local conventions for separator characters, add
the string /i
to the end of the format string.
examples (123456.789):
0
- (123456) show only digits, no precision0.00
- (123456.78) show only digits, 2 precision0.0000
- (123456.7890) show only digits, 4 precision0,000
- (123,456) show comma and digits, no precision0,000.00
- (123,456.78) show comma and digits, 2 precision0,0.00
- (123,456.78) shortcut method, show comma and digits, 2 precision0.####
- (123,456,789) Allow maximum 4 decimal places, but do not right pad with zeroesParameters:
Js.number Js.t
The number to format.
Js.js_string Js.t
The way you would like to format this text.
Returns:
Js.js_string Js.t
The formatted number.
method numberRenderer : 'i. Js.js_string Js.t -> 'i Js.callback Js.meth
Returns a number rendering function that can be reused to apply a number format multiple times efficiently.
Parameters:
Js.js_string Js.t
Any valid number format string for number
Returns:
_ Js.callback
The number formatting function
method parseBox : 'j 'k. 'j Js.t -> 'k Js.t Js.meth
Parses a number or string representing margin sizes into an object. Supports CSS-style margin declarations (e.g. 10, "10", "10 10", "10 10 10" and "10 10 10 10" are all valid options and would return the same result).
Parameters:
_ Js.t
The encoded margins
Returns:
_ Js.t
An object with margin sizes for top, right, bottom and left
method plural : Js.number Js.t ->
Js.js_string Js.t -> Js.js_string Js.t Js.optdef -> unit Js.meth
Selectively do a plural form of a word based on a numeric value. For example, in a template,
{commentCount:plural("Comment")}
would result in "1 Comment"
if commentCount was 1 or
would be "x Comments"
if the value is 0 or greater than 1.
Parameters:
Js.number Js.t
The value to compare against
Js.js_string Js.t
The singular form of the word
Js.js_string Js.t
(optional)
The plural form of the word (defaults to the singular with an "s")
method round : 'l. 'l Js.t -> Js.number Js.t -> Js.number Js.t Js.meth
Rounds the passed number to the required decimal precision.
Parameters:
_ Js.t
The numeric value to round.
Js.number Js.t
The number of decimal places to which to round the first parameter's value.
Returns:
Js.number Js.t
The rounded value.
method stripScripts : 'm. 'm Js.t -> Js.js_string Js.t Js.meth
Strips all script tags.
Parameters:
_ Js.t
The text from which to strip script tags
Returns:
Js.js_string Js.t
The stripped text
method stripTags : 'n. 'n Js.t -> Js.js_string Js.t Js.meth
Strips all HTML tags.
Parameters:
_ Js.t
The text from which to strip tags
Returns:
Js.js_string Js.t
The stripped text
method substr : Js.js_string Js.t ->
Js.number Js.t -> Js.number Js.t -> Js.js_string Js.t Js.meth
Returns a substring from within an original string.
Parameters:
Js.js_string Js.t
The original text
Js.number Js.t
The start index of the substring
Js.number Js.t
The length of the substring
Returns:
Js.js_string Js.t
The substring
method trim : Js.js_string Js.t -> Js.js_string Js.t Js.meth
Alias for Ext.String.trim.
Trims whitespace from either end of a string, leaving spaces within the string intact. Example:
var s = ' foo bar ';
alert('-' + s + '-'); //alerts "- foo bar -"
alert('-' + Ext.String.trim(s) + '-'); //alerts "-foo bar-"
Parameters:
Js.js_string Js.t
The string to trim.
Returns:
Js.js_string Js.t
The trimmed string.
method undef : 'o 'p. 'o Js.t -> 'p Js.t Js.meth
Checks a reference and converts it to empty string if it is undefined.
Parameters:
_ Js.t
Reference to check
Returns:
_ Js.t
Empty string if converted, otherwise the original value
method uppercase : Js.js_string Js.t -> Js.js_string Js.t Js.meth
Converts a string to all upper case letters.
Parameters:
Js.js_string Js.t
The text to convert
Returns:
Js.js_string Js.t
The converted text
method usMoney : 'q. 'q Js.t -> Js.js_string Js.t Js.meth
Format a number as US currency.
Parameters:
_ Js.t
The numeric value to format
Returns:
Js.js_string Js.t
The formatted currency string