About sendData of DataProcessor, to "sent all at once"


#1

I study Gantt these days. about DataProcessor, I want to send all data at once.But I found a strange problem about DataProcessor.setTransactionMode method. If my code like this :

  this.dataProcessor = gantt.createDataProcessor({
     url: "http://192.168.0.88:9999/savePlanData",
     mode:"JSON"
  });
this.dataProcessor.setTransactionMode({
  	mode:"POST",
  	headers:{
  		"Access-Control-Allow-Origin": "http://192.168.0.88:9999"			
  	}
  }, true);

it can’t sent all data at once, it made many times request to server.
but, if I modify code like this:

this.dataProcessor = gantt.createDataProcessor({
url: “http://192.168.0.88:9999/savePlanData”,
mode:“JSON”
});

  this.dataProcessor.setTransactionMode("POST", true);

it can sent all data at once. I don’t know if it’s a bug?


#2

Hello,
Thank you for informing about that. Looks like the second parameter is ignored when the first parameter is an object. So, as a workaround, you can specify it this way:

this.dataProcessor.setTransactionMode("POST", true);
this.dataProcessor.setTransactionMode({
  	mode:"POST",
  	headers:{
  		"Access-Control-Allow-Origin": "http://192.168.0.88:9999"			
  	}
});

I added it as a bug in our internal tracker. The dev team will fix it in future versions, but I cannot give you any ETA.


#3

Hello @laukin,

New Gantt version 7.0.4 contains the fix of the issue:
https://docs.dhtmlx.com/gantt/whatsnew.html#704