Question

I have a Content Part in Orchard, to which I added a Taxonomy Field and set it to allow multiple terms. When I save a content item, it looks like the terms are re-ordered in alphabetical order. But I would like to preserve the order in which they were authored in the field.

E.g. here is what I author in my Taxonomy field:

Contributors: [Sebastien Ros] [Bertrand Le Roy]

And here is what it turns into after saving:

Contributors: [Bertrand Le Roy] [Sebastien Ros]

Is there a way to prevent terms re-ordering? If this is by design, does anyone familiar with implementation know if this can be patched easily? Would it make sense to create a pull-request and contribute a patch to Orchard? I mean, would it be useful for other users, so that the fix has a chance to be included in core. (Otherwise, I would have to maintain a modified version of Orchard and have problems upgrading to new versions, which is undesirable of course). Thanks!

Était-ce utile?

La solution

You should never count on the order in which the records are stored in the database. It is way too brittle, and has never been designed for this. If you need to have control over the order of terms, and have different orders depending on context, you need to use something else. The latest source code version of Vandelay.Industries has a projection filter that lets you drag and drop items in the order you want, for that specific projection.

Autres conseils

If you go to the taxonomy section and look for the term itself, you will see a property call Weight which says..: 'If specified, it will be used to sort terms at the same level'.
That should do it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top