There is no documentation that I can see for adding call backs after kendo ui widget code has fired. I have the following kendo ui widget declaration.
$("#scheduler").kendoScheduler({
date: new Date("2013/6/13"), // Change this to current date with twig
startTime: new Date("2013/6/13 07:00 AM"), // Change this to 12:00 AM of current date
allDaySlot: false,
width:600,
height:500,
resize: function(e) {
if (careGiverIsOccupied(e.start, e.end, e.event, e.resources)) {
this.wrapper.find(".k-marquee-color").addClass("invalid-slot");
e.preventDefault();
}
},
resizeEnd: function(e) {
if (!checkAvailability(e.start, e.end, e.events)) {
e.preventDefault();
}
},
move: function(e) {
if (careGiverIsOccupied(e.start, e.end, e.event, e.resources)) {
this.wrapper.find(".k-event-drag-hint").addClass("invalid-slot");
}
},
moveEnd: function(e) {
if (!checkAvailability(e.start, e.end, e.event, e.resources)) {
e.preventDefault();
}
},
add: function(e) {
if (!checkAvailability(e.event.start, e.event.end, e.event)) {
e.preventDefault();
}
changeColors();
},
save: function(e) {
if (!checkAvailability(e.event.start, e.event.end, e.event)) {
e.preventDefault();
}
changeColors();
},
views: [
"week",
"month"
],
dataSource: {
data: [
{
eventID: 2,
title: "Hey man",
start: new Date("2013/6/13 12:00"),
end: new Date("2013/6/13 13:30"),
pending: true,
permissionToDelete: false,
careGiverId: 1
},
{
eventID: 1,
title: "Call Charlie about the project",
start: new Date("2013/6/13 10:30"),
end: new Date("2013/6/13 11:30"),
pending: false,
permissionToDelete: false,
careGiverId: 1
}
],
schema: {
model: {
id: "eventID",
fields: {
eventID: { type: "number" },
title: { defaultValue: "No title", validation: { required: true } },
start: { type: "date" },
end: { type: "date" },
careGiverId: { nullable: true },
pending: { type: "boolean", defaultValue:true },
permissionToDelete: { type: "boolean", defaultValue:true },
isAllDay: { type: "boolean" }
}
}
}
},
group: {
resources: [ "care" ]
},
resources: [
{
field: "careGiverId",
name: "care",
dataSource: [
{
// Change the text with care giver name, change value with care giver id
text: "Jeffery Dohmer (Care Giver 1)", value: 1, color: "#00FF00"
}
],
title: "Care"
}
]
});
The problem is that the dom structure of my document is modified after the event handlers like resizeEnd, move, moveEnd, add, and save have fired. What I would like to do is to change the color of a particular element after, the kendoScheduler has added or save the time. Is there anyway to add a callback after this is done?
I found an elegant answer for this question. Apparently there is an event called dataBound: that allows one to fire a callback after everything has been done.
In my case I want to use:
dataBound: function(e){
// Code after widget is finished processing everything
}