Filter content items before BuildDisplay

Topics: Customizing Orchard
May 3, 2012 at 7:40 PM

Hello,

I have a containable content type with commonPart and customPart

My customPart driver is filtering and shaping the content summaries properly within the container list - but the commonPart is displaying a duplicate summary (published date only) list also.

I am able to suppress the duplicate summary list via overriding the BuildDisplay, but I would rather filter the data before it gets to BuildDisplay - since there will be a large volume of content items that will not be displayed.

I tried to remove the content in the OnLoaded and OnLoading but was not successful:

OnLoaded((context, part) =>
            {
                if (part.UserId != _userName)
                {
                   part.Record=null;
                }
});

Thanks for any assistance.

May 4, 2012 at 5:30 PM

Hello,

My approach has messed up the Pager control, so I'm going to abandon the idea of using a List content item for this content and go with a data-bound Knockout template - which was my original plan. I was just trying to cheat a bit by piggy backing onto existing content types.

-max