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

Daypilot MVC Contextmenu configuration

Asked by B
7 years ago.

Hello there

Is there anyway we can build teh menu item on serverside rather than client side?
Something like below

DayPilot.Web.Mvc.DayPilotMenuConfig c;
c = new DayPilotMenuConfig();

DayPilot.Web.Mvc.MenuItemCollection s = new DayPilot.Web.Mvc.MenuItemCollection();
DayPilot.Web.Mvc.MenuItem m = new DayPilot.Web.Mvc.MenuItem()
{
Text = "Undo",
Action = MenuItemAction.JavaScript,
JavaScript = "Undo(e);"
};

s.Add(m);

c.Items = s;

I know how to do with client side using e.ContextMenuClientName = "". As we are having a lot of different scenario it will be better if we could do that on server side.

Thanks
Binon

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

You can build the DayPilotMenuConfig on the server side and pass it to @Html.DayPilotMenu helper using a Model. However, this will only work if you know the state when the page is being rendered. If you need to configure the menu depending on the client-side state you'll have to adjust it using JavaScript right before it is displayed.

Comment posted by B
7 years ago.

Thanks Dan

can we configure it during "OnBeforeEventRender"like
protected override void OnBeforeEventRender(BeforeEventRenderArgs e)
{
}

Thanks
B

Comment posted by B
7 years ago.

Is there any way we can customize the time range context menu as well? We need to have different context menu items depending upon the dropdown selection. is there any way we can disable time range selection for particular area may be some particular date?

Comment posted by B
7 years ago.

I even tried

protected override void OnBeforeCellRender(BeforeCellRenderArgs e)
{
if (IsBankHoliday(e.Start))
{
e.CssClass = "holiday_cell";
e.InnerHtml = "Bank Holiday";
e.IsBusiness = false;
e.Areas.Add(
new DayPilot.Web.Mvc.Data.Area()
.Start(e.Start.Date)
.End(e.Start.Date.AddHours(24))
.Top(0)
.ContextMenu("ctxMenuRighClickNone")
.Bottom(0)
.Style("background-color: #D3D3D3; opacity: 1; border-right-color:red")
.Html("<div style='color: Green; margin-left: 35px; font-weight: bold; font-size: 16pt;'>" + "BANK HOLIDAY" + "</div>")
.Visible());
}
}

The context menu is over ridden by time range selection default one

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