An immediately application of the Factory pattern involves Ext.data.HttpProxy. Since initial configuration is all that is likely necessary, not extension, a Factory is perfect. For example, Ruby on Rails needs the Accept header to be set to ‘application/javascript’ for its magic to work when rendering a reply.
Ext.ns('liaison.util'); liaison.util.HttpProxyWithOptions = function(config) { return new Ext.data.HttpProxy(Ext.apply({ headers:{'Accept':'application/javascript'} }, config)); }; var ds = new Ext.data.Store({ id:'factories', proxy:liaison.util.HttpProxyWithOptions({ url:'/people', method:'GET' }), ... });
The various patterns for extending and configuring Ext JS components is on the wiki. Absolutely read it. It condenses many of the patterns that are described by Ext JS pros in the forums, but concisely and in a single place.