Developer forum

Forum » Dynamicweb 10 » Is Dynamicweb.Content.Items.Editors.ItemListEditor no longer available?

Is Dynamicweb.Content.Items.Editors.ItemListEditor no longer available?

Kevin O'Driscoll
Reply

Upgrading to DW10 and scratching my head as to why some of our Item Types are not working. The broken ones have a list of ItemTypes using:
<editor type="Dynamicweb.Content.Items.Editors.ItemListEditor, Dynamicweb"> this field has been renamed eg. Images_MISSED_TYPE and its type changed to Text.

For example we have a Carousel Item type that has a list of Image Item types and a button Item type

The data remains as previous. I noted in DW9 for field settings the Type Item List is marked as deprecated so I would like to know how we now handle this in DW10.

There seems to be no field selection options for ItemListEditor has this been removed?

the only documentation I could find relating to ItemTypes in DW10 was this: 
https://doc.dynamicweb.dev/documentation/internal/archive/Implementation/ItemTypes.html?q=Items
https://doc.dynamicweb.dev/documentation/implementing/items.html?q=Items

Regds Kevin


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Can you provide examples of the item types - are they dfined in code or in the UI (XML files)

Thanks, Nicolai

 
Kevin O'Driscoll
Reply
Here is  part of the Carousel Item Type XML, we dont do custom stuff on ItemTypes, we like the database synchronization, Ive omitted irrelevant code:
 
<?xml version="1.0" encoding="utf-16" standalone="yes"?>
<items>
  <item category="Page Content" name="Carousel" systemName="Carousel" description="Add a Carousel to your page" icon="FileO" iconColor="None" image="" includeInUrlIndex="False" pageDefaultView="item" fieldForTitle="" title="" inherits="">
    <fields>
      <field name="Images_MISSED_TYPE" systemName="Images" description="" type="System.String, System.Private.CoreLib" excludeFromSearch="False" defaultValueCulture="en-GB" defaultValue="System.Collections.Generic.List`1[System.String]">
        <editor type="Dynamicweb.Content.Items.Editors.TextEditor, Dynamicweb">
          <editorConfuguration><Parameters addin="Dynamicweb.Content.Items.Editors.TextEditor" /></editorConfuguration>
        </editor>
        <options sourceType="Static">
          <Static>
            <option name="Link" value="Link" icon="" />
            <option name="Image" value="Image" icon="" />
            <option name="Title" value="Title" icon="" />
            <option name="Alternative Text" value="Alternative_Text" icon="" />
          </Static>
        </options>
      </field>
 
... Omitted for clarity 
 
      <field name="Content Button" systemName="Content_Button" description="" type="System.String, System.Private.CoreLib" excludeFromSearch="False">
        <editor type="Dynamicweb.Content.Items.Editors.ItemTypeEditor, Dynamicweb">
          <editorConfuguration><Parameters addin="Dynamicweb.Content.Items.Editors.ItemTypeEditor"><Parameter addin="Dynamicweb.Content.Items.Editors.ItemTypeEditor" name="Item type" value="Hyperlink_Button" /><Parameter addin="Dynamicweb.Content.Items.Editors.ItemTypeEditor" name="Enable presets" value="False" /></Parameters></editorConfuguration>
        </editor>
      </field>
    </fields>
    <rules>
      <rule name="Allow in websites" type="Dynamicweb.Content.Items.Activation.AreaRestrictionRule, Dynamicweb" value="*" />
      <rule name="" type="Dynamicweb.Content.Items.Activation.ChildItemTypeRestrictionRule, Dynamicweb" value="Carousel_Image,Hyperlink_Button" />
      <rule name="Allowed children" type="Dynamicweb.Content.Items.Activation.ChildRestrictionRule, Dynamicweb" value="" />
      <rule name="Allowed parents" type="Dynamicweb.Content.Items.Activation.ParentRestrictionRule, Dynamicweb" value="RegularPage" />
      <rule name="Enable item type for" type="Dynamicweb.Content.Items.Activation.StructureRestrictionRule, Dynamicweb" value="Paragraphs" />
    </rules>
    <layout>
      <groups>
        <group name="Carousel" systemName="Carousel" collapsibleState="None" visibilityField="" visibilityCondition="0" visibilityConditionValueType="" visibilityConditionValue="">
          <fields>
            <field systemName="Images" />
          </fields>
        </group>
        <group name="Carousel Content" systemName="Carousel_Content" collapsibleState="None" visibilityField="" visibilityCondition="0" visibilityConditionValueType="" visibilityConditionValue="">
          <fields>
            <field systemName="Content_Heading" />
            <field systemName="Carousel_Content" />
            <field systemName="ShowCharLength" />
            <field systemName="Content_Button" />
            <field systemName="ThemeSelector" />
          </fields>
        </group>
      </groups>
    </layout>
  </item>
</items>
 
Kevin O'Driscoll
Reply

As an experiment I changed 

<editor type="Dynamicweb.Content.Items.Editors.TextEditor, Dynamicweb">
          <editorConfuguration><Parameters addin="Dynamicweb.Content.Items.Editors.TextEditor" /></editorConfuguration>
        </editor>

To:

<editor type="Dynamicweb.Content.Items.Editors.ItemRelationListEditor, Dynamicweb">
          <editorConfuguration><Parameters addin="Dynamicweb.Content.Items.Editors.ItemRelationListEditor" /></editorConfuguration>
        </editor>

and all hell broke loose when I saved!!:

500
https://hags10.local.com/Admin/Api/ItemFieldSave?Query.SystemName=Images&Query.ItemTypeSystemName=Carousel&Query.MakeCopy=false&Query.Type=ItemFieldBySystemNameAndItemType
{
    "status": "error",
    "message": "There was error during item synchronization. Look log files {\\System\\Log\\items\\ActivationWorkflow} for details",
    "exception": "System.Exception: There was error during item synchronization. Look log files {\\System\\Log\\items\\ActivationWorkflow} for details
   at Dynamicweb.Content.ItemService.SaveItemType(ItemType itemType)
   at Dynamicweb.Content.UI.Commands.Settings.ItemTypes.ItemFieldSaveCommand.Handle()
   at Dynamicweb.Management.Api.Controllers.Api.DataController.GetCommandResult(Type commandType, Type queryType, String body)
   at Dynamicweb.Management.Api.Controllers.Api.DataController.Post(String command, Object body)",
    "model": null,
    "modelIdentifier": null
}

2023-08-24 11:20:18.2053|items/ActivationWorkflow|ERROR|Dynamicweb.Content.Items.Activation.DatabaseFirstActivationWorkflow: Item type Carousel: exception during update
System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting the nvarchar value '4893,9752,5063' to data type int.
The statement has been terminated.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite, String methodName)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Dynamicweb.Data.Database.ExecuteNonQuery(IDbCommand command)
   at Dynamicweb.Data.Database.ExecuteNonQuery(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
   at Dynamicweb.Data.Database.ExecuteNonQuery(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction)
   at Dynamicweb.Content.Items.Activation.DatabaseBuilder.AlterColumns(IDbConnection conn, String tableName, IDictionary`2 columnsToAlter)
   at Dynamicweb.Content.Items.Activation.DatabaseBuilder.SyncTable(ItemType item, IDbConnection conn)
   at Dynamicweb.Content.Items.Activation.DatabaseBuilder.SyncTable(ItemType item)
   at Dynamicweb.Content.Items.Activation.DatabaseFirstActivationWorkflow.Update(IEnumerable`1 items)
ClientConnectionId:dfe21bca-0284-4fa6-b978-7d6ac2983057
Error Number:245,State:1,Class:16

 

Boom!!  :-)

Rgds Kevin

 
Kevin O'Driscoll
Reply

I've attached the two ItemType examples' .xml files

 

You must be logged in to post in the forum