Ext drag instance (including background interaction)

From , 5 Years ago, written in JavaScript, viewed 105 times.
URL https://pastebin.vip/view/2bf283c0
  1. function triggerDrag(){
  2.         var node=null;
  3.        
  4.         Ext.each(Ext.getCmp('left_panel'),function(accrd){
  5.                 Ext.each(accrd.items.items,function(tree){
  6.                         tree.getRootNode().cascade(function(node) {
  7.                                 if (!node.isLeaf() && !node.isLoaded()) {
  8.                                         node.collapse(false,false);
  9.                                         while(node.firstChild){
  10.                                                 node.removeChild(node.firstChild).destroy()
  11.                                         }
  12.                                         node.childrenRendered=false;
  13.                                         node.loaded=false;
  14.                                         if(node.isHiddenRoot()){
  15.                                                 node.expanded=false;
  16.                                         }
  17.                                         node.expand(false,false,function(){
  18.                                                 node.collapse();
  19.                                         },null);
  20.                                         return true;
  21.                                 }
  22.                                 if (node.attributes['url'] && node.attributes['url'].indexOf('HealthReport') > 0) {
  23.                                        
  24.                                         //委派拖拽
  25.                                         var proxy=new Ext.dd.DragSource(node.getUI().getEl(),{group:'dd'});
  26.                                         var target=new Ext.dd.DDTarget('dargDiv','dd');
  27.                                        
  28.                                         //完成拖拽后触发的事件
  29.                                         proxy.afterDragDrop = function(target, e, idc) {
  30.                                                
  31.                                                 if(Ext.get("srt" + node.attributes.id)){
  32.                                                         Ext.Msg.alert('提示','此快捷方式您已经添加!');
  33.                                                         return;
  34.                                                 }
  35.                                                
  36.                                                 //构造快捷方式持久化对象
  37.                                                 var obj = {
  38.                                                         shortcutname : node.attributes.text,
  39.                                                         shortcuttype : '0',
  40.                                                         shortcutcode : node.attributes.code,
  41.                                                         shortcutid : Number(node.attributes.id),
  42.                                                         shortcuturl : node.attributes.url,
  43.                                                         userid : top._APP.operator.id
  44.                                                 };
  45.                                                
  46.                                                 //持久快捷方式对象
  47.                                                 _Ajax.request({
  48.                                                         url : 'system/Common_saveObj.action',
  49.                                                         params:{
  50.                                                                 clazz:'com.tbyf.health.entity.XtShortcut'
  51.                                                         },
  52.                                                         xmlData: obj,
  53.                                                         result : function(obj) {
  54.                                                                 initShortcuts();
  55.                                                         }
  56.                                                 });
  57.                                         };
  58.                                 }
  59.                                 return true;
  60.                         });
  61.                 });
  62.         });
  63. }

Reply to "Ext drag instance (including background interaction)"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website