I will try to add few points based on my experience in extjs 4.x.
- Communication between different controller.(use fireEvent on application)
this.fireEvent('expand', this, cmp, e);
- Lazy initialization of controller.
someAction: function() { var controller = this.getController('AnotherController'); // Remember to call the init method manually controller.init(); }
- Avoid "Id" in coding for reusable component
Don't put id to components, Add id to where it use in your code
{ xtype:'customercombo', id:'cust-project-field-cust-name' }
- Avoid using Ext.getCmp()..use Ext.ComponentQuery
- Minimize no of panel in application.
- Avoid using ownerCt proprety
- Reduce container nesting
- Reduce border layout nesting
- Try to reuse the code
- Make a cleaner separation between model,view and controller
Only put static code in view and event code in controller and model to store the data
- Replace Panels with Containers
Panel is more expensive than contaier. Declare
xtype: 'container'
to avoid default panel.{
xtype: 'container', // defaultType is 'panel'
items: [ ... ]
}
No comments:
Post a Comment