[Solved] Nested Blocks Preview
# help-with-umbraco
c
V13.5.2 For a carousel I'm trying to replicate Nested Content with a Block List within a Block Grid Block while using the Umbraco.Community.BlockPreview package. The overall Carousel is a Block Grid Block called "Image Carousel". It's element type just has a "Carousel List" Block List of "Carousel Item"s. Each "Carousel Item" holds an image, link and caption info. I have a View for the "Image Carousel" and it displays ok on the front end. But in the back end, I can see the image and info in the page but not in the flyout editors. Do I need another View for the "Carousel Item" or won't it work with the BlockPreview package?
r
Hey @Craig100! Yes, if you want the editors in the side panel to have previews, that block list editor will need the preview file adding to each data type
c
So is that back to manual methods in the app_plugin folder then?
r
Nope you can still use BlockPreview! Edit the Carousel List datatype, then click on the Carousel Item block in there and add a Custom View
c
Ah, I see, you mean a custom view as in /Views/Partials/blockgrid/Components. Great, I'll give that a go. Thanks πŸ™‚
r
You should already have a view for your Block List item in /Views/Partials, adding the
block-preview.html
as the Custom View for that Block List block should link everything together
c
This is starting to do my head in. I can see the end result in the back office, but if I click to open it I get an error for each carousel item. However, if I click on each of the errorred items, I see the correct representation of the carousel item. https://cdn.discordapp.com/attachments/1309251944828899388/1309492674260369418/image.png?ex=6741c796&is=67407616&hm=d1f21960734d9fd937b26fbf5b2ea25efdd004d064570114479a08643c9df384&
There seems to be a bit in the middle that's not quite right and I'm not too sure where it is.
r
Have you got a Block Grid partial called Carousel Item too? It looks as though the partial it’s trying to load is inheriting from BlockGridItem rather than BlockListItem
For this to work you need a partial in /Views/Partials/blocklist/Components for your Carousel Item, that has @inherits UmbracoViewPage<BlockListItem>
c
That was it! It's always (usually) the little things. I was inheriting BlockGridItem. Thanks. πŸ™‚
12 Views