Twitter Call us on +44 (0)1256 486557

Lazy data associations in ExtJS4

A common problem to try and solve in ExtJS is how to use data associations effectively.  There are numerous posts around the web and on Sencha’s forum that explain the best way to do this, but we feel the most overlooked is how to load associations lazily.  Most examples elsewhere talk about nested data loading via a single store, but a common problem is interacting with it.  Most of the time we don’t want to load nested data as the backend source is restful for example.  However, fear not, as using this technique you can easily load the data on demand, using multiple stores automatically generated using Sencha’s built in associations.  Have a play with the example below and use the web inspector to get an idea of what data is loading and when  ;-)

The code below generates the above example.