Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Extjs-拖放限制,安全壳_Extjs_Drag And Drop - Fatal编程技术网

Extjs-拖放限制,安全壳

Extjs-拖放限制,安全壳,extjs,drag-and-drop,Extjs,Drag And Drop,在Extjs中,我想知道是否可以限制元素在特定x,y坐标内的拖动,就像jQueryUI中的一个包含选项一样 目前这是我的代码: abc.prototype.initDrag = function(v) { v.dragZone = new Ext.dd.DragZone(v.getEl(), { containerScroll : false, getDragData : function(e) {

在Extjs中,我想知道是否可以限制元素在特定x,y坐标内的拖动,就像jQueryUI中的一个包含选项一样

目前这是我的代码:

abc.prototype.initDrag = function(v) {
    v.dragZone = new Ext.dd.DragZone(v.getEl(), {
                containerScroll : false,
                getDragData : function(e) {
                    var sourceEl = e.getTarget(v.itemSelector, 10);
                    var t = e.getTarget();
                    var rowIndex = abc.grid.getView().findRowIndex(t);
                    var columnIndex = abc.grid.getView().findCellIndex(t);
                    var abcDragZone = v.dragZone ; //Ext.getCmp('idabcDragZone');
                    var widthToScrollV = $(window).width()-((columnIndex-1)*100);
                    var widthToScrollH = $(window).height()-((5-rowIndex)*30);
                    abcDragZone.setXConstraint(0,widthToScrollV);
                    abcDragZone.setYConstraint(widthToScrollH,0);
                    if ((rowIndex !== false) && (columnIndex !== false)) {
                        if (sourceEl) {
                            abc.isDragged = true;
                            def.scriptGrid.isDraggableForObject = false;
                            def.scriptGrid.dragRowIndex = false;
                            d = sourceEl.cloneNode(true);
                            d.id = Ext.id();
                            d.textContent = "\$" + abc.grid.getColumnModel().getColumnHeader(columnIndex);
                            return {
                                ddel : d,
                                sourceEl : d,
                                sourceStore : v.store
                            }
                        }
                    }
                },
                getRepairXY : function() {
                    return this.dragData.repairXY;
                },
            });    
}
但问题是,当csv工作表添加到DOM中时,会调用initdrag。只有在添加该元素时,才能访问该元素,并且可以设置单个单元格的拖动限制。因此,一旦我添加了csv,就无法设置限制。如果我再次将其添加到DOM中,那么限制就起作用了。extjs中是否有类似于jQuery UI包含Dragable的选项

编辑: 我甚至试过:

constrainTo( constrainTo, [pad], [inContent] )
尸体的身份证是abc 当我试着

dragZoneObj.startDrag = function(){
                                this.constrainTo('abc');
                            };
这是DragZone类的一个方法。它仍然没有覆盖整个身体标签