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

Using font-awesome icons in the context menu

Asked by Naomi
4 months ago.

Hi,

I'd like to be able to use font-awesome icons for the images in the right click context menu. Would it be possible?

Thanks in advance.

Answer posted by Dan Letecky [DayPilot]
4 months ago.

Yes, it's possible. Just use the "icon" property to specify the CSS classes:

var dp = new DayPilot.Scheduler("dp", {
   // ...
  contextMenu: new DayPilot.Menu({
    items: [
    { text: "User details...", icon: "fas fa-user" }
    ]
  }),
});

See also (now with a Font Awesome example):
https://api.daypilot.org/daypilot-menu-items/

Comment posted by Naomi
4 months ago.

Very nice, thanks!

BTW, for dynamic menu context (my other question), I was thinking of trying to directly adjust items for the context menu in the onBeforeEventRender event. Do you think it's possible? I didn't find any good examples of how can I have dynamic menus (using JavaScript) depending on event's extra properties.

Comment posted by Dan Letecky [DayPilot]
4 months ago.
Comment posted by Naomi
4 months ago.

It would be nice if in addition to disabled we can have visible attribute for the items, so we can hide them if needed.

Do you think it would be possible to add? [Alternatively, it can be named "hidden"]

Thanks in advance.

Comment posted by Dan Letecky [DayPilot]
4 months ago.

The "hidden" property is implemented. It's now mentioned in the API docs as well (https://api.daypilot.org/daypilot-menu-items/).

Comment posted by Naomi
4 months ago.

Too bad there is no "Like" button in this forum :) Did you implement it just now or it was not mentioned in the docs? In any case, thanks a lot!

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