Tuesday, July 10, 2012

Extjs with Salesforce - Best Practices

Few practices which can be implemented while using ExtJs Library :-

  • Before starting any development , finalize the version of Extjs which you will use.Migrating from one version to another isn't easy.If you are working on live project , its better to start off with the commercial licensed version provided by the customer.  
  • Avoid including unnecessary resources(.js file) on VF page.'ext-all.js' and 'ext-all.css' are sufficient. Include plugin resources only when you are using it.
  • The following piece of code helps resolve may issues related to IE browser       
  1.         if(Ext.isIE){
  2.            Ext.enableGarbageCollector=false;
  3.         }
  • If you intend to show Extjs Grid with Pagination support  for a large set of records , then ,It will be always advisable to write a custom Pagination Logic and avoid using PagingProxy/PagingMemoryProxy.Using the above proxies will result in view state issue.
  • Make use of JSON.serialize() and  JSON.deserialize() methods in SF, to form a Json string and to form a list using deserialize respectively.Make sure you define all the variables in the Ext.Model with their correct Type.You can validate your json string on http://jsonlint.com/
  • While defining any component in Extjs , try avoiding extra comma(,) For Example:-
  1.   {
  2.       header: "Name",
  3.       width:75,
  4.       dataIndex: 'Name',
  5.       sortable: true,    // Avoid this extra comma
  6.   }
           This cause issues in IE browser.
  • Include the following resource file to debug the javascript errors caused due to Extjs resource :- 'ext-all-dev.js'
  • Moreover, refer to the sencha link for API documentation. It is quite helpful.  http://docs.sencha.com/ext-js/4-0/#!/api
  • You can post your queries on the Sencha forums as well. There are many active users here who will help you.   http://www.sencha.com/forum/

No comments:

Post a Comment