Views: 1226
Number of votes: 13
Average rating:

Custom model for LinkItemCollection property

In many CMS project, we have many requirements that use LinkItemCollection property but with customize model (default is LinkItem).

Below is the way we do:

  1. Define property with type LinkItemColleciton in your content type like this:

Image Step1_Add_Property.JPG

2. Add new EditorDescriptor like this:

Image Step2_Add_Custom_Editor_Descriptor.JPG

3. Add new .js file for your custom model like this (match with the path in step 2):

Image Step3_Add_Custom_Item_Model.JPG

3. The last step is HACK way, because of item collection editor need the model above injected from the beginning (@EPiServer guy: should be improved by lazy load !?)

Image Last_Step.JPG

That all!

Apr 13, 2018

Dang Viet Hung
( By Dang Viet Hung, 4/16/2018 4:31:15 AM)

Nice article!

In the past, when our team have to custom LinkItemCollection, i often use builtin PropertyList property of EPIServer. Of cause, it take time than i think and hard to maintain:)

Thank a lot 

Alex Do
( By Alex Do, 4/16/2018 5:07:53 AM)

Great post, thank you for sharing. 

Thien
( By Thien, 4/16/2018 5:12:57 AM)

thanks for sharing.

Please login to comment.