on 2020 Mar 23 3:33 PM
Hello Experts,
I am trying to drag and drop a ui.table.TreeTable row into the planning calendar, using the dragDropConfig aggregation. But unable to achieve the desired outcome...
I added dragDropConfig to table with targetElement as "employeeCalendar" id of planning calendar. Following is the tightly coupled and loosely coupled configs. Kindly assist.
EDITED: I've added the view and controller. I've also replaced planning calendar with a table and the drag drop just works fine. So thought it must something with calendar metadata. Hence, I tried changing the metadata by getMetadata() and set property dnd.droppable = true, which triggers dragEnter event but drop event is never called.
Thanks & Regards,
Akshay
<mvc:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
controllerName="com.crave.graphicaldashboard.controller.GraphicalDashboard" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:f="sap.f"
xmlns:l="sap.ui.layout" xmlns:t="sap.ui.table" xmlns:unified="sap.ui.unified" xmlns:dnd="sap.ui.core.dnd">
<l:Splitter orientation="Vertical">
<PlanningCalendar appointmentsVisualization="Filled" class="sapMPlanCalSuppressAlternatingRowColors" rows="{appointments>/}"
id="employeeCalendar">
<rows>
<PlanningCalendarRow key="Hour" icon="img/employees/1.png" title="{appointments>name}" enableAppointmentsCreate="false" appointments="{path:'appointments>appointments',templateShareable:true}" enableAppointmentsDragAndDrop="false" appointmentDrop="handleAppDrop" appointmentCreate="onAppCreate">
<appointments>
<unified:CalendarAppointment startDate="{appointments>start}" endDate="{appointments>end}" type="Type03"></unified:CalendarAppointment>
</appointments>
</PlanningCalendarRow>
</rows>
<!--<dragDropConfig>
<dnd:DropInfo groupName="toAppointment" drop="onDrop" dragOver="onDragOver" dragEnter="onDragEnter" dropPosition="OnOrBetween"/>
</dragDropConfig>-->
<layoutData>
<l:SplitterLayoutData size="100%"></l:SplitterLayoutData>
</layoutData>
</PlanningCalendar>
<IconTabBar>
<items>
<IconTabFilter text="Orders">
<t:TreeTable id="orderTreeTable" rows="{ path:'treeListModel>/results',parameters: {arrayNames:['results']} }" rowSelectionChange="onTreeTableSelection" selectionMode="None">
<t:columns>
<t:Column width="9rem" filterProperty="OrderNumber">
<Label text="Order Number" design="Bold"/>
<t:template>
<Link text="{parts:[{path:'treeListModel>OrderId'},{path:'treeListModel>OperationNo'}], formatter:'.setOrdOpNo'}" press="onOrderLinkPress"/>
</t:template>
</t:Column>
<t:Column width="25rem">
<Label text="Description" design="Bold"/>
<t:template>
<Text text="{parts:[{path:'treeListModel>OrderDescription'},{path:'treeListModel>OperationShortText'}],formatter:'.setDesc'}"/>
</t:template>
</t:Column>
<t:Column width="10rem">
<Label text="Order Type" design="Bold"/>
<t:template>
<Text text="{treeListModel>OrderType}"/>
</t:template>
</t:Column>
<t:Column width="10rem">
<Label text="Priority" design="Bold"/>
<t:template>
<Text text="{treeListModel>Priority}"/>
</t:template>
</t:Column>
<t:Column width="10rem">
<Label text="Work Center" design="Bold"/>
<t:template>
<Text text="{parts:[{path:'treeListModel>MainWorkCenter'},{path:'treeListModel>Workcentre'}],formatter:'.setWorkCenter'}"/>
</t:template>
</t:Column>
<t:Column width="10rem">
<Label text="Assigned To" design="Bold"/>
<t:template>
<Text text="{treeListModel>PersonNum}"/>
</t:template>
</t:Column>
<t:Column width="10rem">
<Label text="Status" design="Bold"/>
<t:template>
<Text text="{path:'treeListModel>OrderStatusSystem',formatter:'.checkStatus'}"/>
</t:template>
</t:Column>
<t:Column width="10rem">
<Label text="Equipment" design="Bold"/>
<t:template>
<Text text="{treeListModel>HeaderEquipment}"/>
</t:template>
</t:Column>
</t:columns>
<t:dragDropConfig>
<!--<dnd:DragDropInfo sourceAggregation="rows" dropEffect="Move" dragOver="onDragOver" targetElement="employeeCalendar" dropPosition="OnOrBetween" drop="onDrop" dragEnter="onDragEnter"/>-->
<dnd:DragInfo groupName="toAppointment" sourceAggregation="rows"/>
</t:dragDropConfig>
</t:TreeTable>
</IconTabFilter>
<IconTabFilter text="Logs"></IconTabFilter>
</items>
</IconTabBar>
</l:Splitter>
</mvc:View>
//controller
getAppointments: function () {
var obj = [{
"appointments": [{
"start": new Date(),
"end": new Date(new Date().setMinutes(new Date().getMinutes() + 30))
}],
"name": "Employee 1"
}, {
"appointments": [{
"start": new Date(),
"end": new Date(new Date().setMinutes(new Date().getMinutes() + 30))
}],
"name": "Employee 2"
}, {
"appointments": [{
"start": new Date(),
"end": new Date(new Date().setMinutes(new Date().getMinutes() + 30))
}],
"name": "Employee 3"
}];
var model = new sap.ui.model.json.JSONModel(obj);
this.getView().setModel(model, "appointments");
}
Request clarification before answering.
Hello akki_gt ,
I had a same problem. Taget element should be table name. In your example :
your Planning Calendar id is < id="employeeCalendar" >.
Change your target element to employeeCalendar-Table.
targetElement="employeeCalendar-Table"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.