Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorting settings #47

Open
cihangll opened this issue Dec 29, 2020 · 3 comments
Open

Sorting settings #47

cihangll opened this issue Dec 29, 2020 · 3 comments

Comments

@cihangll
Copy link
Contributor

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();
@wakuflair
Copy link
Member

I think this works for settings, any ideas about sorting Group1 and Group2?

@cihangll
Copy link
Contributor Author

Sorry, i have no idea.

@viewtance
Copy link

Anyway could sorting the group1 and group2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants