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

execute a javascript function after commandCallBack success

Asked by Manoj More
6 years ago.

I am using previous/ next feature and navigator calendar of DayPilot.
So i have a Main calendar with Day/Week/Month view and small navigation calendar to the left of it.

When user clicks next button is pressed it will update main calendar.
when user clicks next i also want to change the selection in navigator calendar, which i am able to do it.
my javascript function as follows;

var getEvents = function(){

//code to change navigator calendar selection
if (dpNavigator.selectMode == 'week') {
var startDate = new DayPilot.Date(dpNavigator.selectionStart.addDays(7));;

PROBLEM : Changing navigator calendar selection happens immediately (javascript normal behavior).
can we pass our own javascript callback function which will get executed once the dp.commandCallBack('next'); is successful?
or Is there any other way using which we can achieve the same behavior?

I hope I could able to explain the scenario.

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

I recommend relying on the Navigator to request the events using the standard mechanism:

1. Let the "Next" button change the navigator only:

<a href="#" id="next">Next</a>

  $("#next").click(function() {;
    return false;

2. Calling .select() will fire the Scheduler OnCommand event with Command set to "navigate". This is the standard mechanism of updating the Scheduler when a user changes the date using the navigator (use BoundDayPilot property of the Navigator to link it to the Scheduler).

See also:

Comment posted by Manoj More
6 years ago.

Thanks Dan! for you response.
I have corrected the code as suggested by you. Still the behavior is same.
my new code is as follows;

$("#next").click(function() {

var showNext= function(){
if (dpNavigator.selectMode == 'week') {;
return false;

Have I implemented it correctly? Please let me know if anything need to change.

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