Custom query how to ignore pagination?

Topics: Core, Customizing Orchard, General
Oct 10, 2014 at 9:54 AM
Edited Oct 10, 2014 at 9:56 AM
Hello there Orchard people,

I have myself a custom query on a custom content type (Forum Topic, has a title and a message). This query basically just looks at the Forum Topic and display them in descending order. I place this query into a widget and it displays correctly on the page, however this widget is on a page that displays Forum Topics (the custom query is used to display the latest forum topics) and the first page looks fine, but when I go and look at page two which adds "?page=2" to the address the main page changes so the older topics are shown however, my "Latest Topics" widget is now displaying the its page 2..... How can I force my query to only display the first 5 items and nothing else.

Regards

P.S.

I have unchecked the "Show Pager" in the widget

"Optional. Provide a suffix to use when multiple pagers are displayed on the same page, e.g., when using multiple Projection Widgets, or to define alternates.
Show pager
Check to add a pager to the list."
Oct 10, 2014 at 11:32 AM
I now have something like this
    public List<string> GetLatestTopics(string contentType)
    {
        var commonPartList = _orchardServices.ContentManager.Query(contentType).ForPart<TitlePart>().ForVersion(VersionOptions.Published).List();


        List<string> topics = commonPartList.Select(x => x.Title).ToList();
        topics = topics.OrderByDescending(x => x).ToList();

        topics = topics.Take(5).ToList();

        return topics;
    }
This works fine, however I need to order by CreatedUTC date
Oct 10, 2014 at 11:50 AM
It's ok I did it in the end, cheers forum :)
Developer
Oct 12, 2014 at 1:09 AM
Glad to hear you figured it out. Perhaps you could share your solution with the audience?