On March 6th, 2008 David Ethell (not verified) says:
I downloaded the new zip file with the latest changes. I'm still having trouble in the call to setPlannerValue in my replacePlanner function.
First, here is my function again:
replacePlanner: function(newPlanner){
for (var d in this.planner) {
var dt = new Date( d );
this.removeEventsByDate(dt);
}
for ( var planId in newPlanner ) {
var plan = newPlanner[planId];
var planDate;
if(Object.isString(plan.period)) {
planDate = new Date(plan.period);
}
else {
planDate = plan.period;
}
if ( planDate != null )
this.setPlannerValue( planDate.getFullYear(), planDate.getMonth() + 1, planDate.getDate(), plan.label, plan.cls );
}
It correctly removes all the current events and it correctly calls setPlannerValue. However, inside setPlannerValue it is not able to find any element in this line:
var el = this.cells[cellIndex].select('.dayboxvalue')[0];
That line just leaves "el" as undefined in javascript (using Firebug to debug). Whereas before the latest code the "this" special variable was pointing to the Window instead of the scal object, it does now correctly point to the scal object while I'm inside setPlannerValue, but it is just unable to find any element object.
Any ideas? Is there a better way to do what I'm trying to do which is to remove all the elements and just put an entirely new planner in place but without refreshing the entire calendar?
ReplacePlanner function still not working with new version
I downloaded the new zip file with the latest changes. I'm still having trouble in the call to setPlannerValue in my replacePlanner function.
First, here is my function again:
replacePlanner: function(newPlanner){
for (var d in this.planner) {
var dt = new Date( d );
this.removeEventsByDate(dt);
}
for ( var planId in newPlanner ) {
var plan = newPlanner[planId];
var planDate;
if(Object.isString(plan.period)) {
planDate = new Date(plan.period);
}
else {
planDate = plan.period;
}
if ( planDate != null )
this.setPlannerValue( planDate.getFullYear(), planDate.getMonth() + 1, planDate.getDate(), plan.label, plan.cls );
}
It correctly removes all the current events and it correctly calls setPlannerValue. However, inside setPlannerValue it is not able to find any element in this line:
var el = this.cells[cellIndex].select('.dayboxvalue')[0];
That line just leaves "el" as undefined in javascript (using Firebug to debug). Whereas before the latest code the "this" special variable was pointing to the Window instead of the scal object, it does now correctly point to the scal object while I'm inside setPlannerValue, but it is just unable to find any element object.
Any ideas? Is there a better way to do what I'm trying to do which is to remove all the elements and just put an entirely new planner in place but without refreshing the entire calendar?
David