Paul-DS / bootstrap-year-calendar

[DEPRECATED] A fully customizable year calendar widget, for boostrap !
Apache License 2.0
294 stars 243 forks source link

PopupWindow on clickDay shows only sometimes #137

Closed 4dil closed 7 years ago

4dil commented 7 years ago

Hello, I've used same part of code from http://www.bootstrap-year-calendar.com/#Examples/Full%20example which was bounded to mouseOnDay, on the clickDay function. After I've encountered next issue, sometimes, the popover does not show up at all. Even if I could see, through the logs, that function itself was called and executed, the popover doesn't show up. Cannot understand what is wrong. The javascript used is attached in txt format clickDayPopupWindow.txt . Please help me understand what is wrong with it. Thanks in advance!

William-H-M commented 7 years ago

Hi, on the script linked, in the mouseOnDay is empty, not sure if it was intended or you didn't copy that part but what should go is :


 mouseOnDay: function(e) {
 if(e.events.length > 0) {
                var content = '';

                for(var i in e.events) {
                    content += '<div class="event-tooltip-content">'
                                    + '<div class="event-name" style="color:' + e.events[i].color + '">' + e.events[i].name + '</div>'
                                    + '<div class="event-location">' + e.events[i].location + '</div>'
                                + '</div>';
                }

                $(e.element).popover({
                    trigger: 'manual',
                    container: 'body',
                    html:true,
                    content: content
                });

                $(e.element).popover('show');
            }
}
4dil commented 7 years ago

Hello, thanks for responding. But let me clarify, my intention was to show popover after leftclicking, Ive left mouseOnDay empty, to show that no code is running there. Now I think that maybe it still executing the empty code, but I've commented that part (/mouseOnDay: function....,/) and still facing the issue popover "pops" after clicking on the day with some event, but sometimes, it even if I can see that day have some events, after clicking, popover does not "pop". That is the problem.

William-H-M commented 7 years ago

Hi, So let me see if I got it this time:

You want to when LeftClicking any day with event then that day show the event, if have it, and as per that I assume that you don't need the create event modal.

If it's that, please confirm while I try to do it on sample project that I have

4dil commented 7 years ago

Yes, I need to show popover when leftclicking. And it actually works, but in my experience something happens sometimes, and does not work for some days. I.e. if event goes few days , when clicking on some day of that event, will show popover, clicking another does not show it. And I can't understand trigger, what leads to this, because after reloading page clicking on both of that days might show popover. My assumption was - it could be click on some day with event when some popover still on the screen, but again sometimes it works, and sometimes it does not.

William-H-M commented 7 years ago

Hi, Not totally sure if is what you want but, can you please try it out? Here the page and the code

4dil commented 7 years ago

Ok, I've played a bit with a forked project, and found out that this problem is happening when I include

library. My example: page and the code. So if I dont include it, all working fine, so next question what functionality bears this popover library? Because it is not clear for me, I could use popover without using this library?

William-H-M commented 7 years ago

Hi, just a quick question is see you do have <script src="./js/bootstrap.min.js"></script> that be itself include the popover script, so maybe those two are conflicting.

Well, its main functionality is to use the popover script (function) without the need of use all the bootstrap library, so if you have bootstrap included is not necessary to have the popover include because maybe will crash a few things.

BTW, I see that on line 168 you verify if the popover is still there, you shouldn't do it that way, because it's slower as it's used through JQuery that will take a little more of time, use

  if(e.events.length > 0) {
                $(e.element).popover('hide');
            } 

what's intended by the code it's self and will be a little better for performance.

If any other question just ask :)

4dil commented 7 years ago

Thank you for your help!