### Overview

In w2ui library there are several global variables.

#### w2ui

All objects you create - layouts, grids, toolbars, sidebars, tabs, forms - will be attached to global w2ui object. Initially it is an empty object, but as soon as you start creating widgets, they will become part of this object. This object serves two important purposes:

- It provides a common and uniform way for accessing created objects
- It makes sure that you will not overwrite already created object (object name must be unique)

For example, if you created a grid with name myGrid then it can be accessed in the following manner: w2ui['myGrid'].get(3); // returns record with id=3 // or w2ui.myGrid.get(3);

#### w2obj

If you need to add custom methods to the prototype of layout, grid, etc, you can use w2obj global variable, so that a method will be instantly available for all objects of that type. You can also overwrite default methods for all widgets. For example: w2obj.grid.prototype.myFunction = function () { console.log('This function exists in all grids. ', this); }

#### w2utils

This global variable has useful generic functions for data validation, data sanitation, data formatting, encoding, etc. For example, you can check if a string is in email format by: w2utils.isEmail('som@email.com'); // returns true if the string is a valid email See w2utils.methods for more information.