When i edit the end date field and set to the some new date, onSave it does not retain its original value using .set method,
Or any other field for that case, if i edit and onSave if i try set the old value It will not set , (will not reflect in the UI)
$scope.ganttOptions = {
dataSource: $scope.ganttDataSource,
dependencies: $scope.ganttDataDependency,
columns: [
{ field: 'id', title: "Task ID", width: 50, sortable: true},
{ field: "title", title: "Title", width: 100, sortable: true, editable: true },
{ field: "days", title: "Duration", type: "number", width: 50, editable: true},
{ field: 'start', title: "Start", sortable: true, format: "{0:MM/dd/yyyy}", width: 100, editable: true },
{ field: 'end', title: "End", sortable: true, format: "{0:MM/dd/yyyy}", width: 100, editable: true },
{ field: 'percentComplete', title: '%', width: 50, editable: true},
],
views: [
"day",
"week",
{ type: "month", selected: true },
],
add: onAdd,
edit: onEdit,
cancel: onCancel,
save: onSave,
};
//Scenario 1
function onSave(e){
if(e.values.end != undefined){
//Few code here, based on conditions and new values that i get
//In the end i set the end date to its original value
//This does not work
e.task.set("end", e.task.end); //e.task.set("end", new Date("03/16/2016"));
}
}
//Scenario 2
function onSave(e){
if(e.value.end != undefined){
//This way it works, cus edited field is end date and some value is set to days field.
e.task.set("days", 12);
}
}