Editor - Dropdown list sorted by id DESC

Editor - Dropdown list sorted by id DESC

michaelnmichaeln Posts: 8Questions: 4Answers: 0

how can I sort a dropdown list in create/update modal ?

                var response = new Editor(db, "users")
                    .Model<JoinModel>()
                    .Field(new Field("users.site")
                        .Options("sites", "id", "name", q => q.Where("name", "('London', 'New York')", "NOT IN", false).Order("id DESC") )
                        .Validator(Validation.DbValues(new ValidationOpts { Empty = false }))
                    )
                    .LeftJoin("sites", "sites.id", "=", "users.site")
                    .Process(request)
                    .Data();

I try .Order("id DESC") but the dropdown list just sort the "name" ascending.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,697Questions: 1Answers: 10,102 Site admin
    edited August 2016 Answer ✓

    There is some discussion about that in this thread edit corrected link.

    The short answer is no, at the moment I'm afraid. The order is defined by the labels, and they are automatically ordered alphabetically in C# / linq.

    I'm going to look at an option to make it possible to set a custom order in 1.6.

    Allan

  • michaelnmichaeln Posts: 8Questions: 4Answers: 0

    Thank you

This discussion has been closed.