Browse Source

Send storage to parent

pull/1/head
Wahyu Ramadhan 1 year ago
parent
commit
727cbfd8a9
  1. 4
      edit-mode/function/function.js
  2. 1
      edit-mode/function/restActivityLink.js

4
edit-mode/function/function.js

@ -677,6 +677,7 @@ function batchUpdate(){
}).then(function (response) { }).then(function (response) {
$("body").removeClass("loading"); $("body").removeClass("loading");
localStorage.setItem('batchEntity', ''); localStorage.setItem('batchEntity', '');
sendStorage();
refresData(); refresData();
}).catch(function (error) { }).catch(function (error) {
$("body").removeClass("loading") $("body").removeClass("loading")
@ -691,11 +692,14 @@ function batchUpdate(){
$(window).on('beforeunload', function(event) { $(window).on('beforeunload', function(event) {
let batchEntity = localStorage.getItem('batchEntity'); let batchEntity = localStorage.getItem('batchEntity');
sendStorage();
if (batchEntity && batchEntity != '') { if (batchEntity && batchEntity != '') {
event.preventDefault() event.preventDefault()
return event.returnValue = 'You have unsaved changes. Are you sure you want to leave this page?'; return event.returnValue = 'You have unsaved changes. Are you sure you want to leave this page?';
} }
}); });
function sendStorage(){
const batchEntityData = localStorage.getItem('batchEntity'); const batchEntityData = localStorage.getItem('batchEntity');
window.parent.postMessage({ batchEntity: batchEntityData }, '*'); window.parent.postMessage({ batchEntity: batchEntityData }, '*');
}

1
edit-mode/function/restActivityLink.js

@ -198,6 +198,7 @@ var dp = gantt.createDataProcessor(function (entity, action, data, id) {
toBeSet = [batchEntity] toBeSet = [batchEntity]
} }
localStorage.setItem('batchEntity', JSON.stringify(toBeSet)); localStorage.setItem('batchEntity', JSON.stringify(toBeSet));
sendStorage();
// $("body").addClass("loading"); // $("body").addClass("loading");
// return gantt.ajax.put({ // return gantt.ajax.put({
// headers: { // headers: {

Loading…
Cancel
Save