Wednesday, 8 February 2012

How to change the sort order in the editor tree

One of the questions I've been asked by a couple of clients now is whether there is a way to sort the items that appear in the editor tree.

I've recently been asked about one of the sites which is used to advertise cars. In the CMS there is a page called "a list of cars for sale" and underneath that we create "a car for sale". Rather than creating each new car at the bottom of the list, they want to be able to group the cars around registration date. The reason for this is to make it much easier to maintain. If you have 50 cars in a list, it's not easy to manage.

Forgive me that I'm not able to post the actual full code, but I'll do my best to point you in the right direction. It turns out the solution is quite simple. In the "a list of cars for sale" page, you can override the Children property like so:


        public override System.Collections.Generic.IList<ContentItem> Children
        {
            get
            {
                // for each of your children, cast it to a CarForSalePage and sort them with LINQ
                // then return the list cast back to a list of content items
            }
        }

Using this method you really have a powerful tool at your disposal for cutomising the editor. If.. (if!) I ever get time I'd like to fork the code and look at being able to customise this in the admin tool.

Hope this helps!

18 comments:

  1. lots of cool stuff, thanks for doing this blog, am looking into using n2, webforms

    ReplyDelete
  2. Cheers Jason, glad you are enjoying them!

    ReplyDelete
  3. Hi I need to add javascripts is there a way to do i am searching them

    ReplyDelete
  4. hi did you find a way to fix the issue with the visual editor and the masterpages?

    ReplyDelete
  5. Hi Anonymous and Paris, can you give some more details on what you are looking for and I will try to help!

    ReplyDelete
  6. A CMS makes it easier for people to create, edit and publish content on a website. Website publishing has required significant technical skills (HTML, programming).
    Website Design Companies | Web Design Companies Bangalore

    ReplyDelete
  7. I thing this is the programming information of website and application developers to change the sort order in the editor tree.
    Web Design Company India | Web Designing Company India

    ReplyDelete
  8. Thanks so much for this helpful tips come returning for additional interesting information…Keep it up
    website design company bangalore | web designing companies bangalore

    ReplyDelete
  9. Excellent Information..It is easier for people to create, edit and publish content on a website.
    Hire Website design Company

    ReplyDelete
  10. Web development is the great concept which is explained only by experts only..You have done a great work by posting this..We hope you will keep posting web development concepts..Thank you for this post..
    Engineering Colleges In Chennai , Nautical Science Colleges In Chennai

    ReplyDelete
  11. Very useful article about seo concepts..It is very easy to understand about seo for beginerrs and learners..kepp posting useful posts like this..Old Age Home in Coimbatore, Charitable Trust in Coimbatore

    ReplyDelete
  12. The blog is absolutely truly incredible. Lots of large information and inspiration, both of which we all need.
    Bangalore Web Designing Company, Web Development Company Bangalore

    ReplyDelete
  13. I have also bookmarked you for ascertaining out new posts. thanks for displaying my commentaryary in your site.Hotels in Kumbakonam,Budget Hotels in Kumbakonam

    ReplyDelete
  14. I really loved reading your blog. It was very well authored and easy to understand.Hotels in Kumbakonam,Kumbakonam Hotels

    ReplyDelete
  15. A very well-written post. I read and liked the post and have also bookmarked you. All the best for future endeavors. Getting some solution regarding.
    UI Designing Companies, Web Application Development in Bangalore

    ReplyDelete