Try our conversational search powered by Generative AI!

Cannot change the order of available content types when creating pages. Sorts in alphabetical order.

Vote:
 

I am unable to change the order of available page types in edit mode when creating new pages.

I have tried in code to change "order" for the content type (see code below), but the pages are sorted in alphabetical order no matter what I do. If I change the page types Display Name, the order changes.

Is there a setting i´m missed to change order from alphabetic to index?

    [ContentType(
        GUID = "ce73b558-c476-485c-aedc-6edaf055efc2",
        DisplayName = "Lokal Page",
        Description = "Page for locals",
        Order = 20,
        GroupName = Global.GroupNames.Local,
        AvailableInEditMode = true)]
#208510
Oct 25, 2019 11:12
Vote:
 

The api calls Epi makes sorts the contentypes by group and then by sortorder.

In the Dojo-component (ContentTypeListViewModel) the content types are always sorted by localizedName.

One quite dirty solution could be to hook into the default behavior in an initializer-script for your site (<clientModule initializer="your.custominitializer">).

_overrideContentTypeListViewModel: function () {
    lang.extend(ContentTypeListViewModel, {
        _sortContentTypesBase: ContentTypeListViewModel.prototype._sortContentTypes,
        _sortContentTypes: function (types) {
            // Call base/original method
            this._sortContentTypesBase(types);

            if (types && types.length > 1) {
                // Your custom adjustments to the types-array

You could even skip calling/storing the base-method but either way it's not future proof but the simplest way I could find to get it working.

The API will not return any information about sort order in it's model unfortunently.

#208705
Oct 30, 2019 13:37
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.