Orchardcore: What are the differences between ListPart and Named Part Bags

Created on 30 Oct 2019  路  5Comments  路  Source: OrchardCMS/OrchardCore

bag-list

bag-list-2

Common:

  • They are both collections

Differences:

  • You can only have one ListPart per Content Type but you can have multiple Bags

What else do I miss?

All 5 comments

The big difference is

  • BagPart ContentItems are contained inside the same document as the containing ContentItem. This makes using them a lot faster, as it is one database call to retrieve everything. The disadvantage can be that you cannot have an Autoroute on them, so you can only route to the main content item, and then in that page you are able to render the BagPart content items

  • ListPart loosely connects two different ContentItems together, so they can live on seperate routes.

The best example use cases of the two can be seen in TheAgencyTheme, which uses a BagPart to contain all the different content items on the main home page, whereas TheBlogTheme uses a Blog Content Item, with a ListPart of BlogPosts.

There is an open issue asking if the ListPart can be made reusable https://github.com/OrchardCMS/OrchardCore/issues/3469 and I will make a further comment on it shortly.

Related to the other question about being able to have multiple ListPart. I would suggest to create a new part called "Collection" that would be like ListPart but could be used multiple times. Because ListPart ,as it can only be selected once, can provide a nicer Admin experience, like when displaying a Blog (Admin Detail view) it shows its items. Not sure how the editor will work then to add new items. Popups are hard as it needs validation. We did it in O1 it was very hard to maintain. And only being able to select existing is what the Content Picker field is.

"It's a List" is not the same as "I have Lists" hence the distinction between ListPart and CollectionPart.

Good description of the difference between a ListPart and a CollectionPart Sebastien.

Here is a potential tabbed UI for the editor for a CollectionPart. See what you think
possible collection ui

Each collection's list goes onto seperate tab.

That's an interesting way to represent them, but I would make it optional (type-part settings).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

khoshroomahdi picture khoshroomahdi  路  4Comments

szilardcsere89 picture szilardcsere89  路  3Comments

cbadger360 picture cbadger360  路  4Comments

kevinchalet picture kevinchalet  路  4Comments

aghili371 picture aghili371  路  3Comments