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

Change Calendar Data based on Dropdown

Asked by Hennie Francis
8 years ago.

I am new to DayPilot.

I have a dropdown with User's loaded into it, each user must see he's / her own calendar items, so if I select User A, the calendar must do refresh and return results for User A's data... and if I change it to User B, show User's B's Data on the calendar

How can I archive this?

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

In ASP.NET MVC you can request a server-side refresh using Command event handler.

1. Store the filter (the selected user) in the clientState property and invoke the Command event handler:

var selectedUser = $("#user").val(); // jQuery
dp.clientState = { user: selectedUser };
dp.commandCallBack("refresh");

2. On the server side, handle OnCommand() and load the events using the filter value:

class Dps : DayPilotScheduler
{

  protected override void OnCommand(CommandArgs e)
  {
      switch (e.Command)
      {
          case "refresh":
              string user = (string) ClientState["user"];
              Events = // ... load events using the "user" value as filter
              UpdateWithMessage("Refreshed");
              break;
      }
  }
}

The ClientState value will remain the same until you change it either on the server side or on the client side.

See also:
http://doc.daypilot.org/scheduler/commandcallback/

Comment posted by Anonymous
8 years ago.

Hi there Dan,

I have done this, and the dropdown with the filter return the results I want, but don't update the view of the Calendar, any idea why?

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