I want to drag and drop one shape row from ganttChart to other row possition with other parent hierarchy node.
I have a ganttChart with a treetable binding with oData and a ganttrowSetting where the shapes are.
I can change the model value of my shape row but the table show the same data.
<gnt2:GanttChartWithTable
id ="Planificado"
shapeResize ="onShapeResize"
shapeDrop ="onShapeDrop"
shapeConnect ="onShapeConnect"
shapeContextMenu ="onShapeContextMenu">
<gnt2:table>
<TreeTable
id ="treeTablePlanificado"
selectionMode ="Single"
visibleRowCountMode ="Auto"
enableBusyIndicator ="true"
enableColumnReordering ="true"
class ="sapUiSizeCompact">
<columns>
<Column label="Trabajos" minWidth="450px">
<template>
<m:Label text="{ID} - {COMENTARIO}"/>
</template>
</Column>
</columns>
<rowSettingsTemplate>
<gnt2:GanttRowSettings rowId="{ID}">
<gnt2:shapes1>
<gnt2:BaseRectangle
shapeId ="{ID}"
time ="{FECHA_INI}"
endTime ="{FECHA_FIN}"
fill ="#0092D1"
resizable ="true"
draggable ="true"
selectable ="true"
hoverable ="true"
connectable ="true"/>
</gnt2:shapes1>
</gnt2:GanttRowSettings>
</rowSettingsTemplate>
</TreeTable>
</gnt2:table>
</gnt2:GanttChartWithTable>
And controller
// My data binding
treeTableView.bindRows({
path: "/PlanningSet",
filters: [
// My filters
],
parameters: {
countMode : "Inline",
numberOfExpandedLevels : 1,
treeAnnotationProperties : {
hierarchyNodeFor : "ID",
hierarchyLevelFor : "JERARQUIA",
hierarchyParentNodeFor : "ID_PADRE",
hierarchyDrillStateFor : "EXPAND"
}
}
});
// And function when drag and drop
onShapeDrop: function(oEvent) {
var oDraggedShapeDates = oEvent.getParameter("draggedShapeDates"),
gantt = this.getView().byId("Planificado"),
table = this.getView().byId("treeTablePlanificado"),
oModel = this.getView().getModel(),
sShapeId = oEvent.getParameter("lastDraggedShapeUid"),
oShapeInfo = Utility.parseUid(sShapeId),
sPath = oShapeInfo.shapeDataName,
oNewDateTime = oEvent.getParameter("newDateTime"),
oOldTimes = oDraggedShapeDates[sShapeId],
iTimeDiff = oNewDateTime.getTime() - oOldTimes.time.getTime(),
oTargetRow = oEvent.getParameter("targetRow");
oTargetShape = oEvent.getParameter("targetShape");
oModel.setProperty(sPath + "/FECHA_INI",
new Date(oOldTimes.time.getTime() + iTimeDiff));
oModel.setProperty(sPath + "/FECHA_FIN",
new Date(oOldTimes.endTime.getTime() + iTimeDiff));
// Here i modify the parent for set this in other row.
// And when i use:
// oModel.getProperty(sPath + "/ID_PADRE")
// is changed but i dont know how to show the change on the table
oModel.setProperty(sPath + "/ID_PADRE", "MTOMECAN");
}
oModel value is changed but table show the row in the same possition.
I thought to update the model to server and get again the data, but that is a lost of time and resources.