Umbraco.CMS.Backoffice
Umbraco.CMS.Backoffice copied to clipboard
[FEATURE]: Allow for more flexible use of "collection" and "collectionView"
I was testing out the collection
and collectionView
as a way to render listings in my email package. These listings need to contain many of the building blocks that is provided with collection
, here's a mockup:
The background is that I want to render these lists in several places. Sometimes with the filters/search and sometimes without. Sometimes I also need to render two lists in the same view but without any toolbar or pagination. I'm aware that maybe I'm trying to bend things to far here but I wanted to put my problem and ideas on the table.
One of my problems here is that the "collectionView" is a "view" and not just a rendered "collection" - it's kind of assumed that the collection will render alone in a "whole" section area. What I'm trying to do here is to render a "collection" (with it's toolbar, pagination etc.) but not the full view.
I looked at extension points for the collection and found that the core is extending the UmbCollectionDefaultElement
in a couple of places to customize the toolbar (e.g. in Users and Members). So I tried going down that path.
Since my goal was to get rid of the wrapping umb-body-layout
element, I got stuck quite fast since UmbCollectionDefaultElement
does not allow overriding the render-method.
Still eager to get this to work I decided to just copy the file-content from the core into my own element and provide a property on my custom NsCollectionDefaultElement
that would indicate if it needs to render the wrapping umb-body-layout
or not - this way I figured I could reuse the same element both when rendering as a inline collection
and a collection view
.
I was really happy and tried using my custom ns-collection-default-element
inside a view just to realize that it needs to be wrapped inside the umb-collection
element because this is the element that provides the context. Here I stumbled upon the same problem as the render()
method of UmbCollectionElement is not overridable.
I think that a potential solution to my problem would have been to create a class that extends UmbCollectionElement, override the render-method and return my NsCollectionDefaultElement
with the settings i want.
So a very long story here to outline the issue, like I said in the beginning - maybe this is trying to bend things to far?
If not, I'm wondering if you would be open to making the render-methods of UmbCollectionElement
and UmbCollectionDefaultElement
protected so that a extending class could override them?
Or maybe this is a bigger question about making the collection
a things that can be rendered outside a collectionView
in some way? Maybe umb-collection-inline
or something that does not wrap things inside umb-body-layout
?
Just to go against my own idea I know that the intention is to have the "select and bulk actions" show in the bottom toolbar of the view so IF my scenario above would be allowed it would still require me to rebuild the UI for this as well.
Anyway - now the issue is on the table and the air is free - maybe the right answer is: Just build your own element =D
Let me know what you think.
Cheers!