我正在尝试在两个表而不是列表上实现dragDropInfo。但是,当我尝试使用oDraggedControl.getTitle()来返回列表中被拖动项的名称时,将引发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);
}
}
<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>