Is there a way to get the count of all the tasks that are about to be updated? My goal is to build a custom loading bar for my users to show that x amount of tasks are still saving.
Like if I move a task that is linked to 50 more tasks, is there way to get a count of all the effected tasks?
Also please note that for some actions (such as deleting branch of tasks) this event will be called twice - once to send tasks and once to send links.
you can check which is being sent by checking dataProcessor.serverProcessor property -
In case you have dataprocessor configured differently, e.g. in REST mode, each update will be sent individually and you won’t be able to capture a single event containing all records. Instead, you could capture updating of each entry individually docs.dhtmlx.com/api__dataproces … event.html - a record is being saved after onBeforeUpdate fired and until onAfterUpdate fired - so you can capture these events and keep the list of records that are being updated now.
Thanks for the reply! I’m actually using the REST method, so i’ll have to stir something up using the two events you provided me with.
Do you know - is it possible to tell the difference between a ‘Task’ and a ‘Link’ in onAfterUpdate? I’m hoping it is stored in the response somewhere. I just want to use some more custom code if it’s a task. If it’s updating a link I want to do nothing.
Yes, although the approach with checking dataProcessor.serverProcessor url doesn’t seem to be reliable. So currently you’ll need to check an internal property of data processor object for this.
Something like following:
dp.attachEvent(“onBeforeUpdate”, function(id, state, data){
if(updateMode() == “tasks”){
// do something when start updating task
}
return true;
});
dp.attachEvent(“onAfterUpdate”, function(id, state, data){
if(updateMode() == “tasks”){
// do something after task update has been completed
}
});[/code]
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan