calendar slows down with attribut "text:"
type/usage
# Bug Report
I have a table with >100 row's.
I click to edit a row and a modal is showing the detail.
If i use a Calendar-Element in a Modal-Form, the time to display the Form is increasing.
But - if i use the text: property to set the language text for the calendar, the generation of the form slows down extremly. I there a multiple calendar elements, the time for the modal increases with a multiple of elements used.
If i edit it with a view visible rows in the table (or use the modal content in a new tab), the form show up "imitate" (= in a acceptable time). It depends how many rows are viewed.
just guessed : It seams that all (!) elements in the DOM are touched/checked/repainted if i use a calendar element... If it's as i suspect, then it's probably a mistake/bug ;)
that is the language part of the calendar element:
```
{strip}
$('#div_{$feld}').calendar({
type:'{if !isset($type)}date{else}{$type}{/if}',
{if isset($startcalendar)}startCalendar: $('#div_{$startcalendar}'),{/if}
{if isset($endcalendar)}endCalendar: $('#div_{$endcalendar}'),{/if}
{*{if $wert != "0000-00-00" && $wert != "0000-00-00 00:00:00"}
initialDate: Date('{$wert}'),
{/if}*}
{if isset($set_language) && $set_language}
{if $smarty.session.KJFlanguage==1}
firstDayOfWeek:1,
text: {
days: ['Son', 'Mon', 'Die', 'Mit', 'Don', 'Fre', 'Sam'],
dayNamesShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
months: ['Jänner', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
monthsShort: ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
today: 'Heute',
now: 'Jetzt',
},
formatter: { time: 'H:mm',cellTime:'H:mm',datetime:'D MMM, YYYY H:mm',date:'D MMM, YYYY' },
{else}
text: {
days: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fre', 'Sat'],
dayNamesShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
months: ['Januar', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
today: 'Today',
now: 'Now',
am: 'AM',
pm: 'PM'
},
formatter: { time: 'h:mm A',cellTime:'h:mm A',datetime:'D MMM, YYYY h:mm A',date:'D MMM, YYYY' },
{/if}
{/if}
onChange : function (date,text) {
var st = date.getHours();
var mi = date.getMinutes();
var se = date.getSeconds();
var dd = date.getDate();
var mm = date.getMonth()+1;
var yy = date.getFullYear();
if(dd<10) {
dd='0'+dd;
}
if(mm<10) {
mm='0'+mm;
}
if(st < 10) {
st='0'+st;
}
if(mi < 10) {
mi='0'+mi;
}
if(se < 10) {
se='0'+se;
}
{if !isset($type) || $type == "date" || $type == "datetime"}
var datum_string = yy+'-'+mm+'-'+dd;
{else}
var datum_string = '';
{/if}
{if isset($type) && ($type == "time" || $type == "datetime")}
var zeit_string = ' '+st+':'+mi+':'+se;
{else}
var zeit_string = '';
{/if}
var datum= yy+'-'+mm+'-'+dd;
$('#{$feld}').attr('value',datum+zeit_string);
console.log(datum+zeit_string);
$('#div_{$feld}').calendar('set date',text,true,false);
{if isset($ajax)}
Jaxon.Ajax.{$ajax}('{$feld}',datum_string+zeit_string,'{$id}');
{/if}
{if isset($ajaxvoll)}
{$ajaxvoll};
{/if}
}
,
popupOptions: {
position: {if isset($position)}'{$position}'{else}'top left'{/if},
lastResort: 'bottom left',
prefer: 'opposite',
hideOnScroll: false,
forcePosition:true
}
{if isset($today) && $today === true}
, today: true
{/if}
});
{if $wert != "0000-00-00" && $wert != "0000-00-00 00:00:00"}
$('#div_{$feld}').calendar('set date','{$wert}',true,false);
{/if}
{/strip}
```
this script is a Smarty-Template. BUT - if i delete (or set "set_language" to false) the Part "text:" the rendering is much faster...
If you ask why it comes up currently and not in the time of developing : the rows are increasing and now i searched around what the time consuming triggered.
## Steps to reproduce
1. generate a <table> with multiple elements (icon's; colourization; ...)
2. the table should have > 100 Rows
3. Open a modal dialog with > 0 calendar elements (more calendar -> more time consumption)
4. wait for open
## Expected result
opens immediate
## Actual result
site slow's down regarding how many rows in the table bellow and how many calendar elements in the form are used
## Screenshot (if possible)
The Modal Form
<img width="1141" height="1341" alt="Image" src="https://github.com/user-attachments/assets/b84df633-b5bd-4c64-8b77-3136690afe76" />
The `<table>`
<img width="3645" height="1757" alt="Image" src="https://github.com/user-attachments/assets/1541eea2-0c9a-4687-a749-5e278dd313ac" />
## Version
<!-- Include the version of the library you are using (required). -->
2.9.4 - nightly
I go back until version 2.8.7 -> OK (=much faster)
there is the a noticeable time consumption to render the form with Version > 2.8.7
(tested with 2.8.7 / 2.9.0 / 2.9.2 / 2.9.3 / 2.9.3-nightly from 26.6.2024 / 2.9.4 / 2.9.4-nightly from 21.2.2026)
关闭于 2026-02-28 13 条评论