- Home
- Forum
- ASP.NET Core
- Context Menu
Context Menu
Hi support, i've, in my Schedule controle the follow context menu:
<e-context-menu-settings enable="true">
<e-menu-items>
<e-appointment-collection>
<e-appointment id="open" text="Edit" />
<e-appointment id="delete" text="Delete" />
</e-appointment-collection>
</e-menu-items>
</e-context-menu-settings>
It's possible to add the edit and cancel image before the text ? How can i disable programmatically the menu item ?
Thanks in advance
Stefano Capobianco
SIGN IN To post a reply.
3 Replies
VS
Velmurugan S
Syncfusion Team
May 1, 2018 05:06 PM UTC
Hi Stefano,
Thank for Contacting Syncfusion support.
We have prepared a workaround sample to meet your requirement adding image before the text and disable menu items, which can be downloaded from the below location.
http://www.syncfusion.com/downloads/support/forum/137298/ze/ScheduleSampleContextMenuImage-433442187
Please refer to the following code example used in the above sample.
<Code>
<div id="ControlRegion">
<ej-schedule id="Schedule1" width="100%" height="525px" current-date="new DateTime(2017, 6, 6)" create="onCreate" before-context-menu-open="OnBeforeOpen">
<e-appointment-settings subject='"Subject"' start-time='"StartTime"' end-time='"EndTime"' all-day='"AllDay"' recurrence='"Recurrence"' recurrence-rule='"RecurrenceRule"'>
<e-datamanager url="http://js.syncfusion.com/demos/ejServices/api/Schedule/LoadData" cross-domain="true"></e-datamanager>
</e-appointment-settings>
</ej-schedule>
</div>
<script>
function onCreate(args) {
$("#Schedule1").ejSchedule({
contextMenuSettings: {
enable: true,
menuItems: {
appointment: [ // Adding the image before menu item text
{ id: "open", text: "Edit", sprite: "e-icon e-edit_01 e-scheduleedit" },
{ id: "delete", text: "Delete", sprite: "e-icon e-delete e-scheduledelete" }
],
}
}
});
}
function OnBeforeOpen(args) {
var obj = $("#Schedule1").data("ejSchedule");
obj._contextMenu.ejMenu({
fields: { id: "id", text: "text", spriteCssClass: "sprite" }, // Here we are mapping the menu fields
});
setInterval(disableMenuItem, 1000); // Here calling the disableMenuItem method to disable the menu item
}
function disableMenuItem() {
var obj = $("#Schedule1").data("ejSchedule");
var contextObj = obj._contextMenu.data("ejMenu");
contextObj.disableItemByID("delete"); // By using the public method disableItemByID disabling the menu item
}
</script>
</Code>
Please look into our below UG link to know more about the Schedule Context Menu options.
Regards,
Velmurugan
SC
Stefano Capobianco
May 18, 2018 04:29 AM UTC
Hi Velmurugan thanks for your response, your solution work very well.
Stefano
VS
Velmurugan S
Syncfusion Team
May 21, 2018 04:16 AM UTC
Hi Stefano,
Thanks for you update.
We are glad that our given solution helped you to meet your expectation. Please let us know if you need any further assistance on this.
Regards,
Velmurugan
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
SC Stefano Capobianco
- Apr 28, 2018 09:10 AM UTC
- May 21, 2018 04:16 AM UTC