1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Blog Posts sorting

Blog Posts sorting

6 posts, 0 answered
  1. Nigel
    Nigel avatar
    38 posts
    Registered:
    01 Dec 2004
    26 Jun 2008
    Link to this post
    Hi

    I have a requirement to sort on two columns. Is this possible in the blogposts control? For example:

    Blog module has meta key (Integer) for "FeaturedItem". Default is 0, if set, it's 1.

    I need to show all FeaturedItem set to 1, ordered by Publication_Date DESC on top of the list. Setting the Sort Expression in the control to FeaturedItem DESC, Publication_Date DESC doesn't work.

    Alternatively, if it were possible to show only posts with Featured_Item set to 1 ordered by Publication_Date DESC, this would also work.

    Is there an easy way to do this? (I can't use a "Featured" category as this needs to span multiple blogs.) Or am I going to have to write a custom control inheriting from BlogPosts and override something like IMetaSearchInfo[] CreateFilter() ??

    Thanks for any assistance.
  2. Nigel
    Nigel avatar
    38 posts
    Registered:
    01 Dec 2004
    26 Jun 2008
    Link to this post
    Bah, nevermind.

    Using categories works fine across multiple blogs. Should have tried it out first!
  3. Nigel
    Nigel avatar
    38 posts
    Registered:
    01 Dec 2004
    26 Jun 2008
    Link to this post
    Sorry for the triple post, but the plot thickens.

    If I put a category id in the BlogPosts control, it disregards sorting, limit list count, and number of items per page. I've tried it every which way with Behaviour Mode and display mode on every possible permutation. No luck.

    :(
  4. Nikifor
    Nikifor avatar
    232 posts
    Registered:
    18 May 2013
    30 Jun 2008
    Link to this post
    Hello Nigel,

    Yes, we are aware of this problem and unfortunately you can't use the sorting mechanism once you have organized your data in categories. The good news is that we have considered this problem and will provide fix for it as soon as possible.

    Thank you for your understanding.

    Greetings,
    Nikifor
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Sean
    Sean avatar
    271 posts
    Registered:
    31 May 2006
    28 Jul 2008
    Link to this post
    Hi,

    Can you confirm does this problem exist for Tags also.  We have created a module that inherits from Generic content that is experiencing this same symptoms.

    And are their any work arounds at this stage?

    Thanks
    Sean
  6. Nikifor
    Nikifor avatar
    232 posts
    Registered:
    18 May 2013
    29 Jul 2008
    Link to this post
    Hello Sean Molam,

    Your problem is the same as the one reported by Nigel below. The content view controls currently have this restriction that you can use only one kind of filtering for their content.

    My colleague Ivan offered a workaround for the events view control. Please, see the post with instructions below:
    ***************
    I'd like to give you a bit of background on the problem and, hopefully, that will shed some light on the whole situation. The problems you have been describing appear only in situations when EventsView control is filtered by a specific tag. Namely, the tags feature has been implemented quite some time ago, much before the events module and at the time we had decided to not apply paging for the control, filtering or sorting properties when the control is in the tag mode. Sorting was hard coded to Publication_Date. The TagID property was not meant to be used directly through a control, but rather through TagsList control.

    I do see the faults of our thinking at that time and understand that the scenario in which you have been using EventsView control is completely valid. We have already scheduled the refactoring of ContentView control (on which the EventsView control is based) to incorporate the solutions for the problems you have experienced.

    Now, to the solution.

    I have prepared for you customized version of EventsView control and I've attached it to this ticket together with the source (in case you need to change anything else). What I have done in this control is rewired the CreateDataSourceByTag function (which does not use the properties of control) to CreateDataSource function. CreateDataSource function will use all the settings you set (such as sorting, paging, filtering etc.). To CreateDataSource function I have added the logic for filtering by tag. I have commented the whole code in case you decided to modify anything.

    Bear in mind, however, that this new control will not necessarily show all events tagged by a particular tag. For example, if you uncheck "show past events" the past events tagged with a specified tag will not show. I believe this is the kind of behavior you are looking for - but still I wanted to make that clear.

    I have attached the project to this ticket, so you should open this project and make sure to use references from your own website if you are going to rebuild the control. Once you have the .dll file, you should go to page editor and upload this new control to toolbox. You can go to the web.config file then and remove the standard EventsView control from the toolboxControls section, so that your users don't get confused as to which control to use.

    ***************
    I hope you find this solution helpful.
    We apologize for the caused inconvenience.

    Kind regards,
    Nikifor
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
6 posts, 0 answered