Closed stahlnow closed 1 year ago
The documentation states:
my_order
's default value must be 0. The JavaScript which performs the sorting is 1-indexed, so this will not interfere with the order of the items, even if they are already using 0-indexed ordering fields.
so what exactly is your question?
My question is: Why does the reorder
command starts indexing at 1
?
If you use a PositiveIntegerField
for ordering, then value 0 can be used to signalize a not yet ordered field. This is because sometime you first save an object and perform the ordering in a second step.
The other reason is, that HTML is 1-indexed. In CSS there are pseudo selectors such as :nth-child(…)
and they have to start with 1.
I see, thanks for the explanation!
The documentation states that the order field must be 0 by default. The reorder manage command however starts at 1. Which one is correct / does it matter?