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

Remove list fields sorting by type while provisioning #1078

Open
HeToC opened this issue Sep 25, 2017 · 1 comment
Open

Remove list fields sorting by type while provisioning #1078

HeToC opened this issue Sep 25, 2017 · 1 comment
Milestone

Comments

@HeToC
Copy link

HeToC commented Sep 25, 2017

Meta seems to be sorting fields added to the list by type.

Is there a way to remove that sorting cause its is expected to fields to be added in the order they are defined in the code ?

I'm using StandardCSOMProvisionService
SPMeta2FileVersion : 1.2.17191.0958
CSOMProductVersion: 16.1.5715.1200
SharePoint 2016 OnPrem

@HeToC HeToC changed the title Remove list fields sorting while provisioning Remove list fields sorting by type while provisioning Sep 25, 2017
@SubPointSupport
Copy link
Contributor

Until we get a great solution and nice looking API around this one, there are a few kind of dirty workarounds:

/// use this static list, clean up ModelWeigh for typeof(ListDefinition)
/// this thing controls how definitions relate to each other and what's the order while provisioning
DefaultModelWeigh.Weighs

// default model weight looks as following:
// https://github.com/SubPointSolutions/spmeta2/blob/master/SPMeta2/SPMeta2/Common/DefaultModelWeigh.cs

Another way around is to implement your own DefaultModelWeighService similar to this:

// https://github.com/SubPointSolutions/spmeta2/blob/master/SPMeta2/SPMeta2/Services/Impl/DefaultModelWeighService.cs
public class MyDefaultModelWeighService : DefaultModelWeighService
{
/// override this method and retuen your own weighs for ListDefinition
 public override IEnumerable<Common.ModelWeigh> GetModelWeighs()
        {
            return DefaultModelWeigh.Weighs;
        }
}

// then register your custom service instead of out of the box one:
provisionService.ReplaceService(typeof(ModelWeighServiceBase), new MyDefaultModelWeighService ());

These would be really dirty workarounds to get things moving.
Also, this ticket relates to Option to use the order of nodes in which it is defined on model #1014

@avishnyakov avishnyakov added this to the backlog milestone Jan 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants