Description of the Extjs component inheritance template (using GridPanel as an example)
1. Override the initComponent () method and call the initComponent () method of the parent class in this method. For example, subclass. superclass. initComponent. call (this );
2. In initComponent, the following statement is displayed, covering the attributes of the parent class Ext. apply (this, {title: "aaa "});
3. the basic template code is as follows: Ext. ns ("my. component "); my. component. myGridPanel = Ext. extend (Ext. gridPanel, {/*** initialize component */initComponent: function () {// var store = this. store; if (! Store) {store = this. buildStore (this. baseParams);} // The column Model var cm = this. cm; if (! Cm) {cm = this. buildCm ();} // check box. use selModel to configure var sm = new Ext. grid. checkboxSelectionMedol (); Ext. apply (this, {// Add the selModel: sm property of the component here, // pagination toolbar bbar: new Ext. pagingToolbar ({}), colModel: new Ext. grid. columnModel ({// Add columns: cm;}), // set the listeners: {"dbclick": function (){}, "rowClick": function (){},......}}); my. component. myGridPanel. superclass. initComponent. apply (this );},/*** Build store */buildStore: function (baseParams) {Ext. apply (baseParams, {// paging condition}); return new Ext. data. jsonStore ({url: "", idProperty: "", // totalProperty: "", // autoLoad: boolean, root: "data" // data root, json format object array. Fields: [{name: "", mapping: ""}, {name: "", mapping: ""},...]});}, /*** construct data column */buildCm: function () {return [{name: "", dataIndex: "" },{ name: "", dataIndex: ""}] ;}, // You can select a model to obtain the selected record. Multiple getSelections: function () {var records = this. getSelectionModel (). getSelections (); return records;} // You can select a model to obtain the selected records. Only one getSelected: function () {var record = this. getSelectionModel (). getSelected ();}});