Here are various notes I've collected on upgrading our application from Ext3.3 to Ext4.1. The application is about 60,000 lines of javascript. I first tried using the compatibility layer but our application did not work without removing a lot of the code. I therefore gave up on the compatibility layer and proceeded straight to porting directly to Ext4.1. I found it easiest to get our app working with our basic infrastructure and then slowly added code back a module at a time.
Common errors:
Cannot call method 'substring' of undefined
An invalid xtype
Object true has no method 'setUI'
Object true has no method 'hide'
Cannot read property 'dom' of null
Header attribute on a Panel is true. Remove it. Header is now a component not a boolean.
Cannot read property 'model' of undefined
Store's reader is invalid
Cannot read property 'items' of undefined
Cannot call method 'insert' of undefined
Ensure initComponent function calls this.callParent
Cannot call method 'apply' of undefined
Ensure event listener method is correct when calling "on"
Cannot use 'in' operator to search for 'width' in undefined
GridPanel columns property is wrong. "columns: ['name']" should be "columns: [ {dataIndex: 'name'
Changes:
Element.down and Element.child functions have switched
Field width now includes the label width
Ext.form.Basic now has dirtychange and validitychange events, not a clientvalidation event.
Checkbox no longer has check event. Use change event.
Use iconCls instead of cls for Action config objects. Remove x-btn-text-icon.
sortInfo property for Stores is now called sorters. Example, sorters: { property: 'name' }
FieldSet is no longer a Panel
Column renderer "css" has changed to "tdCls" as a parameter of the metadata argument in the renderer function
Do not use "data" property of a record to get an attribute. You must now use the get function.
Function.createDelegate is now Ext.bind
Date.format is now Ext.Date.format
ComboBox:
select event passes an array of records, not a single record
triggerAction default is now 'all'
mode config parameter renamed to queryMode.
TriggerField:
Additional trigger icons are created by adding additional trigger classes. For example, to create a twin trigger field, add the two class properties: 'trigger1Cls : <clsid>' and 'trigger2Cls : <clsid2>' to the trigger field. You should then handle onTrigger1Click and onTrigger2Click.
triggerClass is now triggerCls or trigger1Cls
GridPanel:
The event 'rowdblclick' does not appear to be supported even though it is in the 4.x docs. Use itemdbclick
Default selection mode is now single select. Set multiSelect to true in the grid's config for multiselection.
No more 'autoExpandColumn' property. Instead specify "flex: 1" on the column definition.
Tree:
Always use node.getId(), not node.id
Use node.get(key) to get a node's custom property. Not node.attributes.key.
SelectionModel:
No longer has getSelected(). Only has getSelection()
Tips:
this.callParent() is like using the apply function. It requires its arguments to be in an array.
For a container, extend from Ext.form.FieldContainer
Make sure to use the Ext.form.field.Field mixin.
Remember to call initField() in initComponent()
Set isFormField to false for child components. This prevents Ext.form.Basic from returning the child component's value when calling form.getValues(). In our case, we have FieldContainers which should return a single value.
Use "margin" instead of "style: margin"
Override valueToRaw() function to convert a value into a user presentable (ie. raw) value
Call checkChange() after updating the value in a custom setValue() function