Skip to content

Sorting settings #47

Description

@cihangll

Hi,

I think settings can be sorted on the UI with Weight / Order property.

We can use like this (code side);

context.Add(
  new SettingDefinition(
     ...  
  )
  .WithProperty(SettingUiConst.Weight, "5")
  ...
);

or like this (xml side);

"Setting1": {
    ...
   "Weight": "5"
}

Code Example
SettingInfo

public class SettingInfo
{    
    public short Weight { get; set; }
    ...
}

Default value can be set zero.

SettingUiAppService

... SetSettingDefinitionPropertiesAsync(...) {
    ...
    // Default weight: 0
    if(!si.Properties.ContainsKey(SettingUiConst.Weight))
    {
        si.WithProperty(SettingUiConst.Weight, "0");
    }
    ...
}

in SettingUiAppService.GroupSettingDefinitions:

settingInfos.OrderByDescending(si => (short) si.Properties[SettingUiConst.Weight]).ToList();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions