ImporterOneToManyConfiguration.js (2162B)
1 Ext.define("PartKeepr.Importer.ImporterOneToManyConfiguration", { 2 extend: "Ext.form.Panel", 3 layout: { 4 type: 'vbox', 5 align: 'stretch' 6 }, 7 scrollable: 'y', 8 importerField: null, 9 xtype: 'importerOneToManyConfiguration', 10 model: null, 11 defaultListenerScope: true, 12 defaultConfig: { 13 importBehaviour: "ignore", 14 }, 15 items: [ 16 { 17 xtype: 'radio', 18 boxLabel: i18n("Don't import this sub-entity"), 19 name: 'importBehaviour', 20 inputValue: 'ignore', 21 checked: true, 22 itemId: 'ignore', 23 listeners: { 24 change: "onChange" 25 } 26 }, 27 { 28 xtype: 'radio', 29 boxLabel: i18n("Create new item"), 30 name: 'importBehaviour', 31 checked: false, 32 inputValue: 'createNew', 33 itemId: 'createNew', 34 listeners: { 35 change: "onChange" 36 } 37 }, 38 ], 39 initComponent: function () 40 { 41 this.callParent(arguments); 42 43 var importBehaviourChangeListeners = ["#createNew", "#ignore"]; 44 45 for (var i = 0; i < importBehaviourChangeListeners.length; i++) { 46 this.down(importBehaviourChangeListeners[i]).on("change", this.onImportBehaviourChange, this, {delay: 50}); 47 } 48 }, 49 onChange: function () 50 { 51 this.onImportBehaviourChange(); 52 this.fireEvent("configChanged"); 53 54 if (!this.loading) { 55 Ext.apply(this.importerConfig, this.getImporterConfig()); 56 } 57 }, 58 onImportBehaviourChange: function () 59 { 60 var fieldValues = this.getForm().getFieldValues(); 61 }, 62 setModel: function (model, ignoreModel) 63 { 64 65 }, 66 getImporterConfig: function () 67 { 68 var config = this.getForm().getFieldValues(); 69 70 return config; 71 }, 72 setImporterConfig: function (config) 73 { 74 this.importerConfig = config; 75 Ext.applyIf(this.importerConfig, this.defaultConfig); 76 77 this.loading = true; 78 this.getForm().setValues(this.importerConfig); 79 80 this.loading = false; 81 } 82 83 });