Ext.create and New
Since PSI was developed with ExtJS 4.2, this knowledge point is for this version.
To create an object in JS, it must only be new, so ext.create will eventually have to use new, just to build its internal data structure and attach a lot of code.
The important thing to say three times: Create objects with Ext.create, create objects with Ext.create, create objects with Ext.create.
In the ExtJS, you can forget new!
Ext.define ("PSI. Customer.customerfield ", {extend:" Ext.form.field.Trigger ", Alias:" Widget.psi_customerfield ",//the following code slightly
Here's a new point of knowledge: alias-alias.
Aliases can also be used to create objects, such as the use of the above objects as follows:
{ id: " Editcustomer ", xtype: "Psi_customerfield", parentCmp: me, fieldLabel: "Customer", &nBsp; allowblank: false, labelWidth: 60, labelAlign: "Right", labelSeparator: "", colspan: 2, width: 430, blanktext: "No customer input", beforeLabelTextTpl: Psi. const.required, listeners: { specialkey: { fn: me.oneditcustomerspecialkey, scope: me } } }
Pay special attention to the value of xtype in the above code!
Summary: Alias defines a new xtype, and when you use xtype elsewhere, you can reference the same alias value to create a new object.
The value of alias is in the format: widget. ABCD, then the value of Xtype is ABCD.
In the example: alias: "Widget.psi_customerfield"---xtype: "Psi_customerfield"
Open source Invoicing Psi-extjs knowledge points (3)