I really hope there is a solution as in its current state there is absolutely NO consistency which is bad for the user experience.
On what view do you experience this issue?
Can you please attach screenshot with events’ data?
I am experiencing this on the monthly view.
I am not sure what you mean by my event data. I am using my database to generate the events using the following code.
$ds = $action->get_value(“datestart”);
$ts = $action->get_value(“timestart”);
$de = $action->get_value(“dateend”);
$te = $action->get_value(“timeend”);
$action->set_value("datestart", $ds." ".$ts);
$action->set_value("dateend", $de." ".$te);
$scheduler->render_sql(“SELECT id,datestart,dateend,timestart,timeend ORDER BY id ASC”, “id”, “datestart, dateend, title”);[/code]
As you can see I am ordering the output of the events using the ORDER BY in MySQL. When I view the output my events do not change order so it is the monthly view of the calendar doing it.
I am loading the events using connector:
var dp = new dataProcessor("/calendar/get_data");[/code]
I hope this helps and that there is a solution.
Indeed sorting events on server side won’t help anything (except their order in xml file) as later on they will be re-sorted to be displayed on any view.
For the month view, for example, following logic is used:
if (a._timed && !b._timed) return 1;
if (!a._timed && b._timed) return -1;
a._timed is a flag if event is held for several days (should be displayed as bar).
As you see there is need for events’ ids only in case there their start dates are the same and we are actually using this check.
If I understood correctly in your case there is no consistency in how events are displayed: one or another event can be displayed as first. If you can narrow down it to some events then please provide events properties (their start date, end date, ids).
Make sure that somehow events’ start date is not modified every time you refresh scheduler.
Older versions of scheduler (2.2 and below) can have such issue. They using a bit more simpler sorting logic, but in latest version sorting order is consistent for sure.
I am using 2.3 and was having the issue. The code posted above seems to have resolved the issue.