Utilities

About Utilities

Ext provides a series of general utility functions for working with Javascript and JSON. They vary in their functionality, but all of them aim to make your life as the developer easier.

apply and applyIf

Url Encoding/Decoding

These methods are useful for transforming JSON data to a format that can be transmitted as part of a GET string and vice versa.

Array Handling

The core provides methods for working with arrays and other collections within Javascript.

JSON

JSON stands for Javascript Object Notation. It is used as a data exchange format, where the data looks very similar to javascript object literals. When sending and retrieving data from the server, it is necessary to convert data to and from it's native javascript form. These helper functions assist you to do this. More information about JSON can be found at json.org.

Browser & OS Detection

JavaScript

Ext offers a number of browser-detection features allowing developers to work around implementation issues due to differences between the major browsers. Ext provides detection in both javascript and css, to allow for greater functionality in both these areas.

The following browser detection is available for javascript:

if(Ext.isIE){
    // Do browser specific code here
}

CSS

A similar mechanism is applied in the CSS, various class names are added to the root element and the body depending on the current operating environment. This allows for easier style rules to get around browser quirks. If in strict mode, ext-strict is added to the root. The rest of these are added to the body when appropriate:

/* When in strict mode and using safari, change the font-size. */
.ext-strict .ext-safari .sample-item{
    font-size: 20px; 
}

Type Detection

Since JavaScript is a loosely typed language, it is often necessary to interrogate variables to retrieve their type. Ext provides a series of methods for help in this regard:

Miscellaneous