Take a look at our gantt PHP demo which solves same problem as yours. Project there is configured as follows:
const project = window.project = new ProjectModel({
// Let the Project know we want to use our own Task model with custom fields / methods
taskModelClass : Task,
transport : {
load : {
url : 'php/load.php',
paramName : 'q'
},
sync : {
url : 'php/sync.php'
}
},
listeners : {
beforeSend : ({ params }) => {
// can be used to dynamically add arbitrary parameters to data load/sync requests
// for example here we add "config" parameter (we use it for testing purposes)
const queryString = new URLSearchParams(window.location.search);
params.config = queryString.get('config') || '';
},
syncfail : ({ response, responseText }) => {
if (!response || !response.success) {
backendTools.serverError('Could not sync the data with the server.', responseText);
}
}
}
});
What is output at line 24 above? The URL should then be https://.....?config=[value of queryString]. Is the value correct? Also, how does the network tab request look like? Is the config present in URL?
Well, you need to debug it. You refer to response.details in your load listener so first you need to find out why it is not present when you rely on it. The server response is wrong?
Well, beforeSend event does not take response as a member of its argument (response exists only during load event), therefore it is always undefined in beforeSend.
If you want to send childId that was previously received from the server then you must save it somewhere in the load listener and then retrieve it and set it as param in beforeSend listener.
saki, how can i save childId in load listener and access it in beforeSend? I tried but had scope issues, beforeSync does not recognise childId stored in load listener .