Developer forum

Forum » Development » Item Code-First ItemRelationList field won't render

Item Code-First ItemRelationList field won't render

Kevin Steffer
Reply

I have this field on my Article ItemType

[Field("Files", typeof(Dynamicweb.Content.Items.Editors.ItemRelationListEditor))]
[Group("Files"), SortIndex(10)]
[ItemRelationList("Files", "ResourceFile", SortBy = "", SortOrder = "ASC", ItemType = "ResourceFile", ItemSource = Dynamicweb.Content.Items.Editors.ItemRelationListEditor.ItemListSource.Page, Name = "", Description = "", Fields = new string[] { "Name", "Date" })]
public int Files { get; set; }

But it won't write all my editorconfiguration in to the XML file like it does when I create a similar field in UI

My XML with code-first looks like this:

<field description="" name="Files" systemname="Files" type="System.Int32, mscorlib">
  <editor type="Dynamicweb.Content.Items.Editors.ItemRelationListEditor, Dynamicweb">
    <editorconfuguration>
  </editorconfuguration>
</editor>
</field>

My XML with the UI looks like this:

<field name="Files" systemName="Files" description="" type="System.Int32, mscorlib" defaultValueCulture="en-US" defaultValue="0">
  <editor type="Dynamicweb.Content.Items.Editors.ItemRelationListEditor, Dynamicweb">
    <editorConfuguration><Parameters addin="Dynamicweb.Content.Items.Editors.ItemRelationListEditor"><Parameter addin="Dynamicweb.Content.Items.Editors.ItemRelationListEditor" name="Item type" value="ResourceFile" /><Parameter addin="Dynamicweb.Content.Items.Editors.ItemRelationListEditor" name="Sort by" value="" /><Parameter addin="Dynamicweb.Content.Items.Editors.ItemRelationListEditor" name="Sort order" value="ASC" /><Parameter addin="Dynamicweb.Content.Items.Editors.ItemRelationListEditor" name="Item source" value="Page" /><Parameter addin="Dynamicweb.Content.Items.Editors.ItemRelationListEditor" name="Minumum number of items" value="" /><Parameter addin="Dynamicweb.Content.Items.Editors.ItemRelationListEditor" name="Maximum number of items" value="" /></Parameters></editorConfuguration>
  </editor>
  <options sourceType="Static">
    <Static>
      <option name="Name" value="Name" icon="" />
      <option name="Description" value="Description" icon="" />
      <option name="Date" value="Date" icon="" />
      <option name="File" value="File" icon="" />
    </Static>
  </options>
</field>

Any ideas are appreciated


Replies

 
Vladimir
Reply
This post has been marked as an answer

Hi Kevin,

Please remove attribute: [Field("Files", typeof(Dynamicweb.Content.Items.Editors.ItemRelationListEditor))] - there should be only one definition per field(it rewrites ItemRelationList attribute currently)

Kind regards,

Vladimir

Votes for this answer: 1
 
Kevin Steffer
Reply

Great! Thanks - it works!

 

You must be logged in to post in the forum