mdehoog / Semantic-UI-Calendar

Calendar module for Semantic UI
MIT License
805 stars 127 forks source link

Calendar is Very Slow on heavy dom document! #130

Open beshoo opened 5 years ago

beshoo commented 5 years ago

Dear All, Thank you for this add on

First of all this is how i create the calendar

var today = new Date();
$('.upload_time').calendar({minDate: new Date(today.getFullYear(), today.getMonth(), today.getDate()),
            disableMinute: true,
            popupOptions: {
            position: 'top center',
           delay: {
            show: 0,
           hide: 0
            },
      lastResort: 'top center',
      prefer: 'opposite',
      preserve: true,
      on:'hover',
      hideOnScroll: false
    },
              formatter: {
                date: function (date, settings) {
                  if (!date) return '';
                  var day = date.getDate();
                  var month = date.getMonth() + 1;
                  var year = date.getFullYear();
                  return day + '/' + month + '/' + year;
                }
              }});

Now when i load the document i note that it hit https://github.com/mdehoog/Semantic-UI-Calendar/blob/master/dist/calendar.js#L80 1 Times. which is fine, Clander loaded into the DOM.

Now when i click on the input box ".upload_time" again it calls like this:

refresh

refresh
calendar.min.js:176 create Call
calendar.min.js:667 refresh
calendar.min.js:176 create Call
calendar.min.js:667 refresh
calendar.min.js:176 create Call
calendar.min.js:667 refresh
calendar.min.js:176 create Call

Which it delay the load of the Calendar. I am not talking about selecting Day and Date. which i can understand we need to call a function to render new stuff.

But why there is a lot of calls to create and refresh while the calendar is already created!

parth-kotecha commented 4 years ago

Were you able to find a solution for this somehow ?? I am also facing this same issue

lubber-de commented 4 years ago

We finally fixed this in Fomantic-UI where the calendar module was merged into See testcases here https://github.com/fomantic/Fomantic-UI/pull/1531

beshoo commented 4 years ago

2 years.... Waw I almost forgot about it