PDA

View Full Version : grid to grouping grid drag n drop, remove item



HyGy
16 Nov 2011, 9:09 AM
Hi!

I made 2 grids, drop from first grid to second. Second grid is grouping grid. On the second group there is a property (multiple), if it is false, the group can contain only one element, so when a drop happened, I need to remove the other element from the group.

If I first time drop an item from first to second grid, then it is working. But the second time, it is not working, because, the index is copied too from the first grid.

this is the event:
drop: this.onDropToApproverArea,

This is the drop handler:


onDropToApproverArea: function(node, data, dropRec, dropPosition)
{
this.changedTheGrid=true;

if (data.records[0].get('multiple')=='false')
{
var removeIndex=dropRec.index;
if (dropPosition=='before') { removeIndex++; } else { removeIndex--; }
this.getStoreMaintainApproverListsApproverAreaStore().removeAt(removeIndex);
}

How can I make this work, after the second drop event?

thanks

16 Nov 2011, 7:11 PM
if you have a reference to the dropped record ( dropRec), you can use dropRec.store.remove(dropRec)

HyGy
17 Nov 2011, 4:49 AM
thank's, it is working!