partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

FootprintTree.js (1641B)


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