`
javacoo
  • 浏览: 64458 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Ext4.1 desktop 实现桌面图标可拖拽

    博客分类:
  • EXT
阅读更多
Ext4.1 desktop 实现桌面图标可拖拽:
在 Desktop.js文件中的 initComponent 方法中 加入
me.shortcutsView.on('render', me.onRenderShortcut, me);
onRenderShortcut 方法如下
onRenderShortcut : function(v) {
var me = this;
me.shortcutsView.dragZone = new Ext.dd.DragZone(v.getEl(), {
getDragData: function(e) {
var sourceEl = e.getTarget(v.itemSelector, 10);
if (sourceEl) {
                d = sourceEl.cloneNode(true);
                d.id = Ext.id();
                return {
                    ddel: d,
                    sourceEl: sourceEl,
                    sourceStore: v.store,
                    draggedRecord: v.getRecord(sourceEl)
                }
            }
},
        getRepairXY: function() {
            return this.dragData.repairXY;
        },
        onMouseUp : function(e){
        var currDom = Ext.fly(this.dragData.sourceEl);
        var oldXY = currDom.getXY();
        var newXY = e.getXY();
        var width = currDom.getWidth();
        var height = currDom.getHeight();
        if(Math.abs(oldXY[0]-newXY[0]) > width || Math.abs(oldXY[1]-newXY[1]) > height){
        currDom.setXY(newXY);
        Ext.get(this.dragData.sourceEl).frame('#8db2e3', 1);
        }

}
});
}
ok  大功告成,现在桌面上的图标可以任意拖拽了.

效果图
  • 大小: 34 KB
  • 大小: 119.1 KB
0
3
分享到:
评论
2 楼 jacky66666 2014-01-10  
拖动后有白屏的现象,请问怎么解决?
1 楼 tylike 2013-07-12  
我在ext4.2.1版本中试了你的代码,不知为什么没有反映,你在新新版本中试过吗?
能否指点一下?多谢!

相关推荐

Global site tag (gtag.js) - Google Analytics