Hi,
I have the following code that pops up a window an renders a form within it.
this.down('maintenancewindowdocument').getForm().r eset(); does not reset the form fields. Lets say I load the window in 'Add' mode - the fields are all blank correctly, then I double click on an existing grid row - the fields are then populated with the grid row data, I then click 'Add' but now I get the fields holding on top the previous grid row data rather than being empty.
If I uncomment the commented out code in red everything works!
Any ideas ?
Thanks in advance
I have the following code that pops up a window an renders a form within it.
Code:
Ext.define('MaintainWarehouse.view.MaintenanceWindow', { alias: 'widget.maintenancewindow', closeAction: 'hide', extend: 'Ext.window.Window', height: 300, layout: 'border', modal: true, mode: null, modetype: null, requires: [ 'MaintainWarehouse.view.MaintenanceWindowDocument', 'MaintainWarehouse.view.MaintenanceWindowTaskGroup' ], resizable: false, title: iwmlit.documentdetail, width: 596, initComponent: function() { Ext.apply(this,{ dockedItems: this.buildDockedItems(), items: this.buildItems(), systemCodes: this.buildSystemCodes() }); this.callParent(arguments); }, buildItems: function() { return { items: [{ itemId: 'maintenancewindowdocument', xtype: 'maintenancewindowdocument' },{ itemId: 'maintenancewindowtaskgroup', xtype: 'maintenancewindowtaskgroup' }] }; }, buildDockedItems: function() { return [{ dock: 'bottom', items: [{ handler: this.saveForm, scope: this, text: iwmlit.save, tooltip: 'save', ui: 'wmsblue', width: 90, xtype: 'basebutton' },{ handler: function() { this.hide(); }, itemId: 'cancelbutton', scope: this, text: iwmlit.cancel, tooltip: 'cancel', ui: 'wmsred', width: 90, xtype: 'basebutton' }], layout: { type: 'hbox', pack: 'center' }, ui: 'footer', xtype: 'basetoolbar' }]; }, buildSystemCodes: function() { // Create system codes stores; WMS.util.Helper.createSystemCodeStore([ 'TAGP' ]); }, setDetail: function(rec, mode, modetype) { this.mode = mode; this.modetype = modetype; switch(this.modetype) { case 'document': this.down('maintenancewindowtaskgroup').hide(); this.down('maintenancewindowdocument').getForm().reset(); this.down('maintenancewindowdocument').show(); if (this.mode === 'update') { this.setTitle(iwmlit.documentdetails + ' - ' + rec.data.DODS931); this.down('maintenancewindowdocument').getForm().setValues(rec.data); } else { this.setTitle(iwmlit.documentdetails); // this.down('#DOCD935').setValue(''); // this.down('#PTCD935').setValue(''); // this.down('#COPY935').setValue(''); // this.down('#SAVE935').setValue('0'); } break; case 'taskgroup': if (this.mode === 'update') { this.setTitle(iwmlit.taskgroupdetails + ' - ' + rec.data.MCDS921); this.down('maintenancewindowtaskgroup').getForm().setValues(rec.data); } else { this.setTitle(iwmlit.taskgroupdetails); this.down('maintenancewindowtaskgroup').getForm().reset(); } this.down('maintenancewindowdocument').hide(); this.down('maintenancewindowtaskgroup').show(); break; } }, saveForm: function() { switch(this.modetype) { case 'document': var form = this.down('maintenancewindowdocument').getForm(); break; case 'taskgroup': var form = this.down('maintenancewindowtaskgroup').getForm(); break; } if (form.isValid()) { switch(this.modetype) { case 'document': this.fireEvent('documentsaved', form); break; case 'taskgroup': this.fireEvent('taskgroupsaved', form); break; } } } });
If I uncomment the commented out code in red everything works!
Any ideas ?
Thanks in advance
Comment