Ext.data.JsonP.Ext_Number({"alternateClassNames":[],"aliases":{},"enum":null,"parentMixins":[],"tagname":"class","subclasses":[],"extends":null,"uses":[],"html":"

Files

A collection of useful static methods to deal with numbers

\n
Defined By

Methods

Ext.Number
view source
( number, min, max ) : Number
Checks whether or not the passed number is within a desired range. ...

Checks whether or not the passed number is within a desired range. If the number is already within the\nrange it is returned, otherwise the min or max value is returned depending on which side of the range is\nexceeded. Note that this method returns the constrained value but does not change the current number.

\n

Parameters

  • number : Number

    The number to check

    \n
  • min : Number

    The minimum number in the range

    \n
  • max : Number

    The maximum number in the range

    \n

Returns

  • Number

    The constrained value if outside the range, otherwise the current value

    \n
Ext.Number
view source
( The ) : Number
Corrects floating point numbers that overflow to a non-precise\nvalue because of their floating nature, for example 0....

Corrects floating point numbers that overflow to a non-precise\nvalue because of their floating nature, for example 0.1 + 0.2

\n

Parameters

Returns

  • Number

    The correctly rounded number

    \n
Ext.Number
view source
( value, defaultValue ) : Number
Validate that a value is numeric and convert it to a number if necessary. ...

Validate that a value is numeric and convert it to a number if necessary. Returns the specified default value if\nit is not.

\n\n
Ext.Number.from('1.23', 1); // returns 1.23\nExt.Number.from('abc', 1); // returns 1\n
\n

Parameters

  • value : Object
    \n
  • defaultValue : Number

    The value to return if the original value is non-numeric

    \n

Returns

  • Number

    value, if numeric, defaultValue otherwise

    \n
Ext.Number
view source
( from, to ) : Number
Returns a random integer between the specified range (inclusive) ...

Returns a random integer between the specified range (inclusive)

\n

Parameters

  • from : Number

    Lowest value to return.

    \n
  • to : Number

    Highst value to return.

    \n

Returns

  • Number

    A random integer within the specified range.

    \n
Ext.Number
view source
( value, increment, minValue, maxValue ) : Number
Snaps the passed number between stopping points based upon a passed increment value. ...

Snaps the passed number between stopping points based upon a passed increment value.

\n\n

The difference between this and snapInRange is that snapInRange uses the minValue\nwhen calculating snap points:

\n\n
r = Ext.Number.snap(56, 2, 55, 65);        // Returns 56 - snap points are zero based\n\nr = Ext.Number.snapInRange(56, 2, 55, 65); // Returns 57 - snap points are based from minValue\n
\n

Parameters

  • value : Number

    The unsnapped value.

    \n
  • increment : Number

    The increment by which the value must move.

    \n
  • minValue : Number

    The minimum value to which the returned value must be constrained. Overrides the increment.

    \n
  • maxValue : Number

    The maximum value to which the returned value must be constrained. Overrides the increment.

    \n

Returns

  • Number

    The value of the nearest snap target.

    \n
Ext.Number
view source
( value, increment, [minValue], [maxValue] ) : Number
Snaps the passed number between stopping points based upon a passed increment value. ...

Snaps the passed number between stopping points based upon a passed increment value.

\n\n

The difference between this and snap is that snap does not use the minValue\nwhen calculating snap points:

\n\n
r = Ext.Number.snap(56, 2, 55, 65);        // Returns 56 - snap points are zero based\n\nr = Ext.Number.snapInRange(56, 2, 55, 65); // Returns 57 - snap points are based from minValue\n
\n

Parameters

  • value : Number

    The unsnapped value.

    \n
  • increment : Number

    The increment by which the value must move.

    \n
  • minValue : Number (optional)

    The minimum value to which the returned value must be constrained.

    \n

    Defaults to: 0

  • maxValue : Number (optional)

    The maximum value to which the returned value must be constrained.

    \n

    Defaults to: Infinity

Returns

  • Number

    The value of the nearest snap target.

    \n
Ext.Number
view source
( value, precision )
Formats a number using fixed-point notation ...

Formats a number using fixed-point notation

\n

Parameters

  • value : Number

    The number to format

    \n
  • precision : Number

    The number of digits to show after the decimal point

    \n
","superclasses":[],"meta":{},"requires":[],"html_meta":{},"statics":{"property":[],"cfg":[],"css_var":[],"method":[],"event":[],"css_mixin":[]},"files":[{"href":"Number2.html#Ext-Number","filename":"Number.js"}],"linenr":5,"members":{"property":[],"cfg":[],"css_var":[],"method":[{"tagname":"method","owner":"Ext.Number","meta":{},"name":"constrain","id":"method-constrain"},{"tagname":"method","owner":"Ext.Number","meta":{},"name":"correctFloat","id":"method-correctFloat"},{"tagname":"method","owner":"Ext.Number","meta":{},"name":"from","id":"method-from"},{"tagname":"method","owner":"Ext.Number","meta":{},"name":"randomInt","id":"method-randomInt"},{"tagname":"method","owner":"Ext.Number","meta":{},"name":"snap","id":"method-snap"},{"tagname":"method","owner":"Ext.Number","meta":{},"name":"snapInRange","id":"method-snapInRange"},{"tagname":"method","owner":"Ext.Number","meta":{},"name":"toFixed","id":"method-toFixed"}],"event":[],"css_mixin":[]},"inheritable":null,"private":null,"component":false,"name":"Ext.Number","singleton":true,"override":null,"inheritdoc":null,"id":"class-Ext.Number","mixins":[],"mixedInto":[]});