When using Extjs, we often use its custom component function to create the components we need, but there is a point to note when using Ext.extend, that is, if your custom component has some fixed items, then These items cannot be directly thrown into the configuration item, but need to be declared in the initComponent function.
Below is a common template
1 2 3 4 5 6 7 8 9 10 11
MyComponent = Ext.extend(Ext.Panel, { initComponent: function(){ Ext.apply(this, { _name: 'MyComponent'//Not required, use console.log to display object names when debugging. }); this.items = [{ //If there are fixed items, they must be set here }]; MyComponent.superclass.initComponent.call(this); } });
In fact, not only items, if you want to add new event listeners for subcomponents, you also need to declare them in initComponents
Ext.Ajax.request
When using Ext. Ajax to send POST requests, you may encounter cross-domain problems, even if the background is set to allow cross-domain, such as the following method