PDA

View Full Version : [CLOSED] When Trigger DragDrop , to check data



gs_user
May 14, 2012, 7:15 AM
Hi,

I have Four GridPanel, A,B,C,D
When drag drop the data from C to D
I have to check the data exits in B Gridpanel or not,And show up warning message
I don't know how to do that
Please give me suggestion, thank you

Daniil
May 14, 2012, 11:18 AM
Hi,

I would override the OnContainerOver and OnNodeOver function of DropZone.

Please look how it can be done.

Markup

<ext:GridView runat="server">
<Plugins>
<ext:GridDragDrop
PluginId="dragdrop"
runat="server"
DragGroup="secondGridDDGroup"
DropGroup="firstGridDDGroup">
</ext:GridDragDrop>
</Plugins>
<Listeners>
<Render Fn="onViewRender" Delay="1" />
</Listeners>
</ext:GridView>

JavaScript

var onViewRender = function (view) {
var dropZone = view.getPlugin("dragdrop").dropZone;

dropZone.onContainerOver = myOnContainerOver;
dropZone.onNodeOver = myOnNodeOver.
};

var myOnContainerOver = function (dd, e, data) {
var me = this,
view = me.view,
count = view.store.getCount();

// There are records, so position after the last one
if (count) {
me.positionIndicator(view.getNode(count - 1), data, e);
}

// No records, position the indicator at the top
else {
delete me.overRecord;
delete me.currentPosition;
me.getIndicator().setWidth(Ext.fly(view.el).getWid th()).showAt(0, 0);
me.valid = true;
}
return me.dropAllowed;
};

var myOnNodeOver = function (node, dragZone, e, data) {
var me = this;

if (!Ext.Array.contains(data.records, me.view.getRecord(node))) {
me.positionIndicator(node, data, e);
}
return me.valid ? me.dropAllowed : me.dropNotAllowed;
};

There is the original code of these function. You should override it to suite your needs.