用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - javascript代码库

Ext拖拽实例(含后台交互)

2014-02-10 作者: Screat举报

[javascript]代码库

function triggerDrag(){
    var node=null;
     
    Ext.each(Ext.getCmp('left_panel'),function(accrd){
        Ext.each(accrd.items.items,function(tree){
            tree.getRootNode().cascade(function(node) {
                if (!node.isLeaf() && !node.isLoaded()) {
                    node.collapse(false,false);
                    while(node.firstChild){
                        node.removeChild(node.firstChild).destroy()
                    }
                    node.childrenRendered=false;
                    node.loaded=false;
                    if(node.isHiddenRoot()){
                        node.expanded=false;
                    }
                    node.expand(false,false,function(){
                        node.collapse();
                    },null);
                    return true;
                }
                if (node.attributes['url'] && node.attributes['url'].indexOf('HealthReport') > 0) {
                     
                    //委派拖拽
                    var proxy=new Ext.dd.DragSource(node.getUI().getEl(),{group:'dd'});
                    var target=new Ext.dd.DDTarget('dargDiv','dd');
                     
                    //完成拖拽后触发的事件
                    proxy.afterDragDrop = function(target, e, idc) {
                         
                        if(Ext.get("srt" + node.attributes.id)){
                            Ext.Msg.alert('提示','此快捷方式您已经添加!');
                            return;
                        }
                         
                        //构造快捷方式持久化对象
                        var obj = {
                            shortcutname : node.attributes.text,
                            shortcuttype : '0',
                            shortcutcode : node.attributes.code,
                            shortcutid : Number(node.attributes.id),
                            shortcuturl : node.attributes.url,
                            userid : top._APP.operator.id
                        };
                         
                        //持久快捷方式对象
                        _Ajax.request({
                            url : 'system/Common_saveObj.action',
                            params:{
                                clazz:'com.tbyf.health.entity.XtShortcut'
                            },
                            xmlData: obj,
                            result : function(obj) {
                                initShortcuts();
                            }
                        });
                    };
                }
                return true;
            });
        });
    });
}


网友评论    (发表评论)


发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...