Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

CollectionEditorDescriptor does not show value of calculated field in table after adding new record

$
0
0

In my project, we have a field using IList<Item> in a page type, we have an issue when we edit a page using this page type:

When I add a new value to IList using CollectionEditorDescriptor:

The value of Label is not showed after clicking Add button:

But after refreshing this page, the value of Label is shown again.

My implemtation for this field is:

Page type: StartPage.cs

[ContentType(
    GUID = "19671657-B684-4D95-A61F-8DD4FE60D559",
    GroupName = Global.GroupNames.Specialized)]
public class StartPage : PageData
{
    [Display(
	GroupName = SystemTabNames.Content,
	Order = 320)]
    [CultureSpecific]
    public virtual ContentArea MainContentArea { get; set; }
    [Display(
	GroupName = SystemTabNames.Content,
	Order = 321)]
    [CultureSpecific]
    [BackingType(typeof(PropertyItem))]
    public virtual IList<Item> Items { get; set; }
}

Item.cs:

public class Item
{
	public virtual string Text { get; set; }
	public virtual string Label
	{
		get
		{
			return "Label of " + Text;
		}
	}
}

PropertyItem.cs:

[PropertyDefinitionTypePlugIn]
public class PropertyItem : PropertyList<Item>
{
	protected override Item ParseItem(string value)
	{
		return JsonConvert.DeserializeObject<Item>(value);
	}
}

ItemEditorDescriptor.cs:

[EditorDescriptorRegistration(TargetType = typeof(IList<Item>))]
public class ItemEditorDescriptor : CollectionEditorDescriptor<Item>
{
	public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
	{
		base.ModifyMetadata(metadata, attributes);
	}
}

Notice: This issue happend after upgrading to Episerver CMS 11. In Episerver CMS 10, no issue.


Viewing all articles
Browse latest Browse all 6894

Trending Articles