简体   繁体   English

在ExtJS中拖动时删除反馈图标

[英]Remove feedback icon while dragging in ExtJS

I have created a DataView in which items are internally draggable to rearrange, but the problem is that, while I can easily drag and re-arrange items within data view, while dragging, the overlay which is created of the item show "Red" feedback icon (which suggests that item cannot be dropped here), while I don't want any feedback icon to be shown (neither green or red), just an overlay of item is enough. 我创建了一个DataView,其中的项目可以在内部拖动以重新排列,但问题是,虽然我可以轻松地拖动和重新排列数据视图中的项目,但在拖动时,创建项目的叠加显示“红色”反馈图标(这表明该项目不能放在这里),虽然我不希望显示任何反馈图标(绿色或红色),只是项目的叠加就足够了。

How to get rid of the feedback icon? 如何摆脱反馈图标?

Short answer, you could just add these two CSS rules: 简短的回答,你可以添加这两个CSS规则:

.x-dd-drag-ghost {
    padding-left: 5px;
}
.x-dd-drop-icon {
    display: none;
}

If you don't want to hide drag drop icon for the whole application, that's a bit more challenging... You have to add a custom css class to the Ext.dd.StatusProxy that will be created for your view. 如果您不想隐藏整个应用程序的拖放图标,那就更具挑战性......您必须将自定义css类添加到将为您的视图创建的Ext.dd.StatusProxy中。 The StatusProxy is created in the constructor of Ext.dd.DragSource of which Ext.dd.DragZone is a subclass. StatusProxy是在StatusProxy的构造函数中Ext.dd.DragSource ,其中Ext.dd.DragZone是一个子类。

So, in the simplest case, if you're creating your drag zone yourself, you can add a class then: 因此,在最简单的情况下,如果您自己创建拖动区域,则可以添加一个类:

var dragZone = Ext.create(...); // existing code
dragZone.proxy.addCls('no-icon');

Otherwise, you'll have to chase down the place where your drag zone/source is created... 否则,您将不得不追逐创建拖动区/源的位置...

Finally, here's the CSS for hiding only icons of proxies with the 'no-icon' class: 最后,这里是仅使用'no-icon'类隐藏代理图标的CSS:

.x-dd-drag-proxy.no-icon .x-dd-drag-ghost {
    padding-left: 5px;
}
.x-dd-drag-proxy.no-icon .x-dd-drop-icon {
    display: none;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM