search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Error while updating cell html after eventMove

Asked by Simone
6 years ago.

Hi Dan,

I've encoutered a strange behaviour of the scheduler that i'll try to explain at my best.

The scheduler is configured in tree mode with parent disabled.

I've implemented an ajax massive delete function that passes parameters (date range and resource ids) to the server, performs the deletion and than return to the client. If all went good it runs a dps.commandCallback("refresh") that actually is an Update(CallBackUpdateType.Full) on the server side.

I have implemented also this function:

dps.onAfterRender = function (args)
{
if (args.isCallBack && args.data != undefined)
{
Object.keys(args.data).forEach(function (key)
{
var parts = key.split("|");

var cells = dps.cells.find(parts[1], parts[0]);

cells.html(args.data[key]);
});

dps.update();
}
}
The key is resourceId concatenated with the date so I can update the summary html in the parent resource so I can easily get the right cell to update.

If I drag&drop an event it works like a charm but if I drag&drop after calling that massive function, than the onAfterRender function updates also cells that aren't in the returning object with the first parent html.

In the attached image you can see the green circle with correct totals, and the red circles with the wrong ones. Those cells are actully empty, but the function I don't know why updates them.

I also noticed that the Row Header Hiding icon disappears after the drag&drop.

If you need more details tell me.

Thank you.

Answer posted by Dan Letecky [DayPilot]
6 years ago.

Hi Simone,

You should try to avoid the direct cell modification. The Scheduler supports OnBeforeCellRender event handler on the server side which will let you specify the cell content in a more declarative way. If you request a full update on the server side it will update everything (including background cells) and you don't have to worry about a specific change.

Also, in this particular case, it's not necessary to call dps.update() - the direct cell modification API doesn't require that.

Anyway, the cells.find() method uses resource id to find the correct row. It returns an array of cells that match the criteria - you can use that to debug what is going on. I don't see any reason why it should return rows where the ID doesn't match the second parameter. Let me know if you see anything suspicious.

Comment posted by Simone
6 years ago.

Hi Dan,

thank you for your reply.

Yes, I know there is OnBeforeCellRender but I was forced to avoid it because the resource tree is very big, something like 10k resources!! I already tried but I found that it is too slow to reload everything at every modification. So I started thinking about direct cell modification.

For dps.update() it was a try that forgot to delete :D.

As you can see in the snippet I put the cells.find() result in a separate variable in order to debug like you suggested, I wrote an if statemente cheking for arrays with length > 1 but never found one, the cell is always one.

It only happens after a full update called with javascript command callback, that's why it seems to be an error...

Do you have any idea?

Thank you again

Comment posted by Simone
6 years ago.

Hi Dan,

do you have any update on this issue?

or as an alternative, can you suggest me the poper way to handle the data refresh for a 10k+ resource tree?

Thank you

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.