⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ddview.js

📁 本系统基本完善了CRM管理系统的各个模块
💻 JS
📖 第 1 页 / 共 2 页
字号:
        }     },          isValidDropPoint: function(pt, n, data) {         if (!data.viewNodes || (data.viewNodes.length != 1)) {             return true;         }         var d = data.viewNodes[0];         if (d == n) {             return false;         }         if ((pt == "below") && (n.nextSibling == d)) {             return false;         }         if ((pt == "above") && (n.previousSibling == d)) {             return false;         }         return true;     },     onNodeEnter : function(n, dd, e, data){     	if (this.highlightColor && (data.sourceView != this)) {	    	this.el.highlight(this.highlightColor);	    }        return false;     },          onNodeOver : function(n, dd, e, data){         var dragElClass = this.dropNotAllowed;         var pt = this.getDropPoint(e, n, dd);         if (this.isValidDropPoint(pt, n, data)) {     		if (this.appendOnly || this.sortField) {    			return "x-tree-drop-ok-below";    		}//            set the insert point style on the target node             if (pt) {                 var targetElClass;                 if (pt == "above"){                     dragElClass = n.previousSibling ? "x-tree-drop-ok-between" : "x-tree-drop-ok-above";                     targetElClass = "x-view-drag-insert-above";                 } else {                     dragElClass = n.nextSibling ? "x-tree-drop-ok-between" : "x-tree-drop-ok-below";                     targetElClass = "x-view-drag-insert-below";                 }                 if (this.lastInsertClass != targetElClass){                     Ext.fly(n).replaceClass(this.lastInsertClass, targetElClass);                     this.lastInsertClass = targetElClass;                 }             }         }         return dragElClass;     },     onNodeOut : function(n, dd, e, data){         this.removeDropIndicators(n);     },     onNodeDrop : function(n, dd, e, data){         if (this.fireEvent("drop", this, n, dd, e, data) === false) {             return false;         }         var pt = this.getDropPoint(e, n, dd);         var insertAt = (this.appendOnly || (n == this.el.dom)) ? this.store.getCount() : n.viewIndex;         if (pt == "below") {             insertAt++;         } //        Validate if dragging within a DDView         if (data.sourceView == this) { //            If the first element to be inserted below is the target node, remove it             if (pt == "below") {                 if (data.viewNodes[0] == n) {                     data.viewNodes.shift();                 }             } else { //    If the last element to be inserted above is the target node, remove it                 if (data.viewNodes[data.viewNodes.length - 1] == n) {                     data.viewNodes.pop();                 }             }      //            Nothing to drop...             if (!data.viewNodes.length) {                 return false;             } //            If we are moving DOWN, then because a store.remove() takes place first, //            the insertAt must be decremented.             if (insertAt > this.store.indexOf(data.records[0])) {                 insertAt--;             }         } //        Dragging from a Tree. Use the Tree's recordFromNode function.         if (data.node instanceof Ext.tree.TreeNode) {             var r = data.node.getOwnerTree().recordFromNode(data.node);             if (r) {                 data.records = [ r ];             }         }                  if (!data.records) {             alert("Programming problem. Drag data contained no Records");             return false;         }         for (var i = 0; i < data.records.length; i++) {             var r = data.records[i];             var dup = this.store.getById(r.id);             if (dup && (dd != this.dragZone)) { 				if(!this.allowDup && !this.allowTrash){                	Ext.fly(this.getNode(this.store.indexOf(dup))).frame("red", 1); 					return true				}				var x=new Ext.data.Record();				r.id=x.id;				delete x;			}            if (data.copy) {                 this.store.insert(insertAt++, r.copy());             } else {                 if (data.sourceView) {                     data.sourceView.isDirtyFlag = true;                     data.sourceView.store.remove(r);                 }                 if(!this.allowTrash)this.store.insert(insertAt++, r);             } 			if(this.sortField){				this.store.sort(this.sortField, this.sortDir);			}            this.isDirtyFlag = true;         }         this.dragZone.cachedTarget = null;         return true;     }, //    Ensure the multi proxy is removed     onEndDrag: function(data, e) {         var d = Ext.get(this.dragData.ddel);         if (d && d.hasClass("multi-proxy")) {             d.remove();             //delete this.dragData.ddel;         }     },     removeDropIndicators : function(n){         if(n){             Ext.fly(n).removeClass([                 "x-view-drag-insert-above", 				"x-view-drag-insert-left",				"x-view-drag-insert-right",                "x-view-drag-insert-below"]);             this.lastInsertClass = "_noclass";         }     }, /**  *    Utility method. Add a delete option to the DDView's context menu.  *    @param {String} imageUrl The URL of the "delete" icon image.  */     setDeletable: function(imageUrl) {         if (!this.singleSelect && !this.multiSelect) {             this.singleSelect = true;         }         var c = this.getContextMenu();         this.contextMenu.on("itemclick", function(item) {             switch (item.id) {                 case "delete":                     this.remove(this.getSelectedIndexes());                     break;             }         }, this);         this.contextMenu.add({             icon: imageUrl || AU.resolveUrl("/images/delete.gif"),             id: "delete",             text: AU.getMessage("deleteItem")         });     },      /**    Return the context menu for this DDView. */     getContextMenu: function() {         if (!this.contextMenu) { //            Create the View's context menu             this.contextMenu = new Ext.menu.Menu({                 id: this.id + "-contextmenu"             });             this.el.on("contextmenu", this.showContextMenu, this);         }         return this.contextMenu;     },          disableContextMenu: function() {         if (this.contextMenu) {             this.el.un("contextmenu", this.showContextMenu, this);         }     },     showContextMenu: function(e, item) {         item = this.findItemFromChild(e.getTarget());         if (item) {             e.stopEvent();             this.select(this.getNode(item), this.multiSelect && e.ctrlKey, true);             this.contextMenu.showAt(e.getXY());         }     }, /**  *    Remove {@link Ext.data.Record}s at the specified indices.  *    @param {Array/Number} selectedIndices The index (or Array of indices) of Records to remove.  */     remove: function(selectedIndices) {         selectedIndices = [].concat(selectedIndices);         for (var i = 0; i < selectedIndices.length; i++) {             var rec = this.store.getAt(selectedIndices[i]);             this.store.remove(rec);         }     }, /**  *    Double click fires the event, but also, if this is draggable, and there is only one other  *    related DropZone that is in another DDView, it drops the selected node on that DDView.  */     onDblClick : function(e){         var item = this.findItemFromChild(e.getTarget());         if(item){             if (this.fireEvent("dblclick", this, this.indexOf(item), item, e) === false) {                 return false;             }             if (this.dragGroup) {                 var targets = Ext.dd.DragDropMgr.getRelated(this.dragZone, true); //                Remove instances of this View's DropZone                 while (targets.contains(this.dropZone)) {                     targets.remove(this.dropZone);                 } //                If there's only one other DropZone, and it is owned by a DDView, then drop it in                 if ((targets.length == 1) && (targets[0].owningView)) {                     this.dragZone.cachedTarget = null;                     var el = Ext.get(targets[0].getEl());                     var box = el.getBox(true);                     targets[0].onNodeDrop(el.dom, {                         target: el.dom,                         xy: [box.x, box.y + box.height - 1]                     }, null, this.getDragData(e));                 }             }         }     },          onItemClick : function(item, index, e){ //        The DragZone's mousedown->getDragData already handled selection         if (this.ignoreNextClick) {             delete this.ignoreNextClick;             return;         }         if(this.fireEvent("beforeclick", this, index, item, e) === false){             return false;         }         if(this.multiSelect || this.singleSelect){             if(this.multiSelect && e.shiftKey && this.lastSelection){                 this.select(this.getNodes(this.indexOf(this.lastSelection), index), false);             } else if (this.isSelected(item) && e.ctrlKey) {                 this.deselect(item);             }else{                 this.deselect(item);                 this.select(item, this.multiSelect && e.ctrlKey);                 this.lastSelection = item;             }             e.preventDefault();         }         return true;     } });  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -