javascript - How to get element in eventContent of FullCalendar v5 and to assign it to tip? - Stack Overflow

I move into FullCalendar v5 from v4 and I try to set hints for any cell.In v4 I used eventRender like:

I move into FullCalendar v5 from v4 and I try to set hints for any cell. In v4 I used eventRender like:

            eventRender: function (eventInfo) {
                let external_google_calendar_button = ""
                if (eventInfo.event.url != "" && typeof eventInfo.event.url != "undefined") {
                    // alert( eventInfo.event.url + "  eventInfo.event..url ::"+( typeof eventInfo.event.url )  )
                    external_google_calendar_button = '<i class=\'fa fa-external-link\' style=\'color:#eaeaea;\' title=\'Has event at Google Calendar\'></i>&nbsp;';
                }
                let adTooltipHtml = '..."

                let editorBtnHTML= '<button type="button" class="action_btn m-0 mr-1 p-0 px-1" @click.prevent="openAdCard( \'' + eventInfo.event.id + '\' )" title="Open ad card">+</button>'


                eventInfo.el.querySelector('.fc-content').innerHTML = '<span class="flex flex-nowrap">'+editorBtnHTML +  eventInfo.el.querySelector('.fc-content').innerHTML + '</span>'

                tippy(eventInfo.el, {
                    content: adTooltipHtml,
                    allowHTML: true,
                    animation: 'fade',
                    delay: 100,
                    duration: 100,
                });

Here I read :

eventContent - a Content Injection Input. Generated content is inserted inside the inner-most wrapper of the event element. If supplied as a callback function, it is called every time the associated event data changes.

and I try to use eventContent event for the same goal :

eventContent: function (eventInfo) {
    console.log('eventContent eventInfo::')
    console.log(eventInfo)
    console.log('eventInfo.event::')
    console.log(eventInfo.event)

But I failed to get access to element to set hint to it. What I see in browser's console : .jpg

How to get element I have to assign tip ?

Thanks!

I move into FullCalendar v5 from v4 and I try to set hints for any cell. In v4 I used eventRender like:

            eventRender: function (eventInfo) {
                let external_google_calendar_button = ""
                if (eventInfo.event.url != "" && typeof eventInfo.event.url != "undefined") {
                    // alert( eventInfo.event.url + "  eventInfo.event..url ::"+( typeof eventInfo.event.url )  )
                    external_google_calendar_button = '<i class=\'fa fa-external-link\' style=\'color:#eaeaea;\' title=\'Has event at Google Calendar\'></i>&nbsp;';
                }
                let adTooltipHtml = '..."

                let editorBtnHTML= '<button type="button" class="action_btn m-0 mr-1 p-0 px-1" @click.prevent="openAdCard( \'' + eventInfo.event.id + '\' )" title="Open ad card">+</button>'


                eventInfo.el.querySelector('.fc-content').innerHTML = '<span class="flex flex-nowrap">'+editorBtnHTML +  eventInfo.el.querySelector('.fc-content').innerHTML + '</span>'

                tippy(eventInfo.el, {
                    content: adTooltipHtml,
                    allowHTML: true,
                    animation: 'fade',
                    delay: 100,
                    duration: 100,
                });

Here https://fullcalendar.io/docs/event-render-hooks I read :

eventContent - a Content Injection Input. Generated content is inserted inside the inner-most wrapper of the event element. If supplied as a callback function, it is called every time the associated event data changes.

and I try to use eventContent event for the same goal :

eventContent: function (eventInfo) {
    console.log('eventContent eventInfo::')
    console.log(eventInfo)
    console.log('eventInfo.event::')
    console.log(eventInfo.event)

But I failed to get access to element to set hint to it. What I see in browser's console : https://i.sstatic/H0aH4.jpg

How to get element I have to assign tip ?

Thanks!

Share Improve this question edited Jun 3, 2022 at 17:14 Mike Irving 1,6301 gold badge14 silver badges23 bronze badges asked Jun 16, 2021 at 8:06 mstdmstdmstdmstd 3,23322 gold badges87 silver badges192 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

I failed to get access to element

...yes because as per the content injection documentation you don't get access to it directly. You simply return the HTML you want to put within it, without any need to know anything about the element you're injecting into.

However that's not really what you're trying to do here - you're trying to attach a tooltip to the whole element.

Again as per the event render hooks documentation, if you use the eventDidMount callback instead, this gives you access to the el property within the supplied data, which represents the element.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745644680a4637898.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信