Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Editing collection of complex objects

Vote:
 

Hello everyone!

Maybe anybody knows how I can edit collection of complex objects in episerver edit UI?

#86706
May 28, 2014 16:55
Vote:
 

Can you explain a little more about what you are trying to accomplish? What type of objects are you trying to edit?

You may want to look into using block types to define a set of properties (http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/75/Content/Block-types-and-templates/), though I don't know if that solves what you are trying to accomplish.

#86715
May 28, 2014 20:11
Vote:
 

I think he is looking for multiple property control which is similar to EPiServer MultipleProperty 

#86721
May 29, 2014 1:47
Vote:
 

I would like to edit collection of simple objects, for example:

public class Item
{
        public int Id { get; set; }
        
        public string Name { get; set; }

        public bool Enabled { get; set; }
}

Or more complex:

public class Item
{
        public int Id { get; set; }

        public string Name { get; set; }
        
        public bool Enabled { get; set; }

        public LinkItemCollection Links { get; set; }

        public ContentArea Items { get; set; }

        public Url Image { get; set; }

        [Required]
        public string Description { get; set; }
}

Solution with blocks is working, but is not useful, because it takes more time to create each additional item and blocks, located in folders, and their amount grows up.


I found in episerver sources CollectionEditorDescriptor and CollectionEditor.js. When I try to mark page property with [EditorDescriptor(EditorDescriptorType = typeof(CollectionEditorDescriptor<Item>))] it renders good CollectionEditor control, but without column captions and it doesn't save data. It would be great to use this out of the box solution.

#86730
Edited, May 29, 2014 9:10
Vote:
 

I believe a contentarea with blocks is still a way to go.

It bothered me as well the process of creating a block and drag&dropping it to the content area. However, with the new shortcut button that came with 7.5, inside the content area, named "You can drop content here, or create a new block", it gets really neat.

When you click on "create a new block", you get all the properties listed + the block gets saved to current page blocks, under "For this page".

As for the amount of them, it should be that these current-page blocks get deleted when the page gets deleted. As for the blocks shared among the pages, you could create a cleanup scheduled job that deletes them if no pages reference it.

#86734
May 29, 2014 10:22
Vote:
 

If you're not finding any solutions that work for you, you might just want to look into creating your own custom EPiServer property with Dojo.

Check out this blog post: http://robertlinde.se/post/custom-episerver-properties-with-dojo

You should be able to get a good idea about what's involved in making a property that works for your situation.

#86754
May 29, 2014 16:36
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.