On-page editing for PropertyList properties

Ted
Ted
Vote:
 

I'm using PropertyList properties, and while I realize that's still in beta I was wondering if there's a way to support on-page editing?

If I use @Html.EditAttributes(m => m.MyListOfItems) I do get an overlay, but when I click it I get the "legacy popup" with a simple textbox for the underlying serialized property value.

I was expecting a popup with the list editor, but then I realized that would potentially lead to multiple popups when items are added/edited - so I guess that wouldn't be optimal. :)

So, I guess my question is two-fold: is there a way to support on-page editing and, if not, are there plans to support it?

#143173
Jan 14, 2016 10:17
Vote:
 

Hi!

Until EPiServer adds on-page editing you can add an editor descriptor for all of your PropertyList<T> properties to at least get the multiple popups thing working:

[EditorDescriptorRegistration(TargetType = typeof(IList<MyModel>))]
public class OnPageCollectionEditorDescriptor : CollectionEditorDescriptor<MyModel>
{
    public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
    {
        base.ModifyMetadata(metadata, attributes);
        metadata.CustomEditorSettings["uiType"] = metadata.ClientEditingClass;
        metadata.CustomEditorSettings["uiWrapperType"] = UiWrapperType.Floating;
    }
}

Then you need to inject some css in edit mode to fix the dialog width:

.dijitDialogPaneContentArea .epi-collection-editor {
    min-width: 640px;    
}

Don't forget to remove the EditorDescriptorAttribute from your property if you go for this workaround.

#143196
Jan 14, 2016 17:06
Ted
Vote:
 

Ah, that's clever! Thanks for the tip!

#143209
Jan 15, 2016 9:57
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.