javascript - How to extend ExtJs component? -
i want extend ext.from.formpanel comprises grid , buttons. found saki's example:
ext.ns('myapp'); myapp.abstractformpanel = ext.extend(ext.form.formpanel, { defaulttype:'textfield' ,frame:true ,width:300 ,height:200 ,labelwidth:75 ,submiturl:null ,submitt:'submit' ,cancelt:'cancel' ,initcomponent:function() { // create config object var config = { defaults:{anchor:'-10'} }; // build config this.buildconfig(config); // apply config ext.apply(this, ext.apply(this.initialconfig, config)); // call parent myapp.abstractformpanel.superclass.initcomponent.call(this); } // eo function initcomponent ,buildconfig:function(config) { this.buildbuttons(config); } // eo function buildconfig ,buildbuttons:function(config) { config.buttons = [{ text:this.submitt ,scope:this ,handler:this.onsubmit ,iconcls:'icon-disk' },{ text:this.cancelt ,scope:this ,handler:this.oncancel ,iconcls:'icon-undo' }]; } ,onsubmit:function() { ext.messagebox.alert('submit', this.submiturl); } ,oncancel:function() { this.el.mask('this form canceled'); } // eo function oncancel }); // eo extend
it may contain many buttons i'll give it. how add grid? gonna put grid in initconmponent
this?
initcomponent:function() { // create config object var config = { defaults:{anchor:'-10'} }; // build config this.buildconfig(config); // apply config ext.apply(this, ext.apply(this.initialconfig, config)); // call parent myapp.abstractformpanel.superclass.initcomponent.call(this); mygrid = new ext.grid.gridpanel({....}); }
where can found example or tutorial?
ps: extjs version 3.4.
the grid fits form container in items block. saki has example of grid in window. http://examples.extjs.eu/one2many.html in can see window component has items array. , grid item in array.
what need have form panel declare items array 1 of items grid.
Comments
Post a Comment