Scott Mebberson

Icon

Web Technologist

Implementing Lazy Loading via a Ghost

Many of our Flex applications contain a datagrid showing a large set of objects. It provides a central point in an interface for users to sort and filter the larger set of data with little effort on our behalf because the datagrid control is so feature rich (i.e. good value for money, or ROI).

Datagrids are also very handy for showing only a limited number of object properties until the user selects a record, generally resulting in a detailed view showing more or all object properties.

You need to be careful however, ensuring you avoid common pitfalls such as loading large data sets all at once, using up more memory than you need to causing the application to feel sluggish and slow.

A fantastic approach to avoiding these situations is to use the Lazy Loading design pattern via a Ghost.

Lazy Loading is the practice of deferring initialisation of an object until the last minute (or the point it is actually required). Using the Ghost implementation of Lazy Loading allows you to load an object in a partial state; or put simply, load only a subset of the objects properties until all of them are required.

The properties you would load initially are those you want to display in the datagrid, and the rest could be loaded and injected into the appropriate object once selected in the datagrid and the detail view appears.

Filed under: flash platform, flex

Leave a Reply