cancel
Showing results for 
Search instead for 
Did you mean: 

DragDropInfo on Two Tables

0 Kudos

Hi experts,

I am trying to get implement dragDropInfo on two tables, instead of list. But when I am trying to use oDraggedControl.getTitle(), which returns name of dragged item from list, Throws error for Tables. So how do I get Dragged column and dropped Column name?

<Table id="container" items="{path: 'container>/ContainerMaster'}" width="auto" noDataText="No data" mode="None" showSeparators="All" growing="true" growingThreshold="44"
growingScrollToLoad="true"> <dragDropConfig>
<dnd:DragDropInfo sourceAggregation="items" targetElement="container1" targetAggregation="items" dropPosition="on" drop="onDrop"
DropEffect="move"/>
</dragDropConfig>  <items> <ColumnListItem>
<cells>
<core:Icon src="sap-icon://shipping-status" size="48px" color="green" height="48px" width="48px" visible="true"/>
<ObjectIdentifier title="{container>CON_ID}" text="{container>CON_WEIGHT}" titleActive="true" visible="true" titlePress="_onObjectIdentifierTitlePress3"/>
<Text text="{container>CON_WEIGHT}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit" visible="true"/>
</cells>
</ColumnListItem>
</items>
</Table>

<Table id="container1" items="{path: 'container>/ContainerMaster'}" width="auto" noDataText="No data" mode="None" showSeparators="All" growing="true" growingThreshold="44"
growingScrollToLoad="true"> <dragDropConfig>
<dnd:DragDropInfo sourceAggregation="items" targetElement="container1" targetAggregation="items" dropPosition="on" drop="onDrop"
DropEffect="move"/>
</dragDropConfig>  <items> <ColumnListItem>
<cells>
<core:Icon src="sap-icon://shipping-status" size="48px" color="green" height="48px" width="48px" visible="true"/>
<ObjectIdentifier title="{container>CON_ID}" text="{container>CON_WEIGHT}" titleActive="true" visible="true" titlePress="_onObjectIdentifierTitlePress3"/>
<Text text="{container>CON_WEIGHT}" width="auto" maxLines="1" wrapping="false" textAlign="Begin" textDirection="Inherit" visible="true"/>
</cells>
</ColumnListItem>
</items>
</Table>

These are the two tables.

onDrop: function (oEvent) {
var txt;
if (confirm("Do you want to tag this item?")) {
var sDropPosition = oEvent.getParameter("dropPosition");
var oDraggedControl = oEvent.getParameter("draggedControl");
var oDroppedControl = oEvent.getParameter("droppedControl");

var dragged = oDraggedControl.getTitle(); ---- throwing error
alert(dragged);

sap.m.MessageToast.show(
oDraggedControl.getTitle() +
" is dropped " +
" at the " +
oDroppedControl.getTitle()
);

var dropped = oDroppedControl.getTitle();
sap.m.MessageToast.show(dropped);
} else {
	txt = "Action Cancelled";
         alert(txt);
	}
}



Accepted Solutions (0)

Answers (0)