StorageLocationTree.js (1699B)
1 Ext.define("PartKeepr.StorageLocationTree", { 2 extend: 'PartKeepr.CategoryEditorTree', 3 alias: 'widget.StorageLocationTree', 4 xtype: 'partkeepr.StorageLocationTree', 5 viewConfig: { 6 plugins: { 7 ptype: 'treeviewdragdrop', 8 sortOnDrop: true, 9 ddGroup: 'StorageLocationTree' 10 } 11 }, 12 folderSort: true, 13 14 categoryModel: "PartKeepr.StorageLocationBundle.Entity.StorageLocationCategory", 15 16 initComponent: function () 17 { 18 this.store = Ext.create("PartKeepr.data.store.StorageLocationCategoryStore"); 19 this.callParent(); 20 }, 21 listeners: { 22 "foreignModelDrop": function (records, target) 23 { 24 for (var i in records) { 25 switch (Ext.getClassName(records[i])) { 26 case "PartKeepr.StorageLocationBundle.Entity.StorageLocation": 27 records[i].setCategory(target); 28 records[i].save({ 29 success: function () 30 { 31 if (records[i].store && records[i].store.reload) { 32 records[i].store.reload(); 33 } 34 } 35 }); 36 break; 37 case "PartKeepr.StorageLocationBundle.Entity.StorageLocationCategory": 38 records[i].callPutAction("move", {parent: target.getId()}, Ext.bind(function () 39 { 40 this.store.load(); 41 }, this)); 42 break; 43 44 } 45 } 46 } 47 } 48 });