Calendar: make calendar-list sortable

Created on 17 Sep 2016  Â·  12Comments  Â·  Source: nextcloud/calendar


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

2 - developing Calendar list JS design enhancement-approved

Most helpful comment

If anyone with the required technical skills wants a workaround, you can manually set the order in the database.

First, connect to the database. If you don't know how to do this then this guide unfortunately isn't for you.

You can view all your calanders using SELECT * FROM nextcloud.oc_calendars;

| id | principaluri              | displayname       | uri                 | synctoken | description | calendarorder | calendarcolor | timezone | components   | transparent |
+----+---------------------------+-------------------+---------------------+-----------+-------------+---------------+---------------+----------+--------------+-------------+
|  2 | principals/system/system  | Contact birthdays | contact_birthdays   |         1 | NULL        |             0 | #FFFFCA       | NULL     | VEVENT,VTODO |           0 |
|  3 | principals/users/nloomans | School            | school              |       241 | NULL        |             0 | #e774ca       | NULL     | VEVENT,VTODO |           0 |
|  5 | principals/users/nloomans | Persoonlijk       | persoonlijk         |         7 | NULL        |             0 | #78e774       | NULL     | VEVENT,VTODO |           0 |
|  6 | principals/users/nloomans | School toets      | school-toets        |         7 | NULL        |             0 | #e78074       | NULL     | VEVENT,VTODO |           0 |
+----+---------------------------+-------------------+---------------------+-----------+-------------+---------------+---------------+----------+--------------+-------------+

Here, I want "Persoonlijk" to be above everything else. To do that, I first have to move the rest down (you can not have negative orders).

UPDATE nextcloud.oc_calendars SET calendarorder=1;

Now I can set the order of the one you want to be first to zero:

UPDATE nextcloud.oc_calendars SET calendarorder=0 WHERE id=5;

And you are done! Simply reload the page and you should see the calendars reordered!

All 12 comments

This looks nice: https://github.com/RubaXa/Sortable
Comes without jQuery \o/

Hm, there is one issue with this feature.
We are currently not able to change the name, color, and also not the order of a shared calendar. We are able to set custom DAV properties though.

In the long run we need to fix this issue in core. (https://github.com/nextcloud/server/issues/1463)

For now there are different possible solutions:

  • store all order properties in a custom DAV property.
  • store only the shared calendar order property in a custom DAV property

cc @tcitworld

Blocked by this stupid line of code ...
https://github.com/nextcloud/server/blob/master/apps/dav/lib/CalDAV/Calendar.php#L179

we should fix https://github.com/nextcloud/server/issues/1463 first ...
Postponing to some NC11+ release

I unsure, if order should be stored in DAV. Isn't this a particular feature of this app?

I unsure, if order should be stored in DAV. Isn't this a particular feature of this app?

Storing the actual order property is the job of the dav app, but I want to make the calendar list sortable. So the calendar client needs to be able to tell the server which order the user wants

Ah, ok. Thanks for the clarification. 😊

It's assigned to the 1.7 milestone ;)

If anyone with the required technical skills wants a workaround, you can manually set the order in the database.

First, connect to the database. If you don't know how to do this then this guide unfortunately isn't for you.

You can view all your calanders using SELECT * FROM nextcloud.oc_calendars;

| id | principaluri              | displayname       | uri                 | synctoken | description | calendarorder | calendarcolor | timezone | components   | transparent |
+----+---------------------------+-------------------+---------------------+-----------+-------------+---------------+---------------+----------+--------------+-------------+
|  2 | principals/system/system  | Contact birthdays | contact_birthdays   |         1 | NULL        |             0 | #FFFFCA       | NULL     | VEVENT,VTODO |           0 |
|  3 | principals/users/nloomans | School            | school              |       241 | NULL        |             0 | #e774ca       | NULL     | VEVENT,VTODO |           0 |
|  5 | principals/users/nloomans | Persoonlijk       | persoonlijk         |         7 | NULL        |             0 | #78e774       | NULL     | VEVENT,VTODO |           0 |
|  6 | principals/users/nloomans | School toets      | school-toets        |         7 | NULL        |             0 | #e78074       | NULL     | VEVENT,VTODO |           0 |
+----+---------------------------+-------------------+---------------------+-----------+-------------+---------------+---------------+----------+--------------+-------------+

Here, I want "Persoonlijk" to be above everything else. To do that, I first have to move the rest down (you can not have negative orders).

UPDATE nextcloud.oc_calendars SET calendarorder=1;

Now I can set the order of the one you want to be first to zero:

UPDATE nextcloud.oc_calendars SET calendarorder=0 WHERE id=5;

And you are done! Simply reload the page and you should see the calendars reordered!

Hello, any update here? If I put a new order following @nloomans trick, does the first one become the default calendar to receive invitations?

I just upgraded to Nextcloud 17 and I was hoping that I can sort my calendars by name, but unfortunately I can't.

Isn't it that easy as put a value in the column _calendarorder_?

Isn't it that easy as put a value in the column calendarorder?

Not quite that simple, but if you would be interested in sending a pull-request i would be happy to give a more detailed explanation how to implement this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

georgehrke picture georgehrke  Â·  3Comments

BornToBeRoot picture BornToBeRoot  Â·  3Comments

andre5tz picture andre5tz  Â·  3Comments

mauritslamers picture mauritslamers  Â·  4Comments

raimund-schluessler picture raimund-schluessler  Â·  3Comments