Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Roman Kalius 6 posts 76 karma points
    Nov 10, 2021 @ 08:48
    Roman Kalius
    0

    Content picker created in js - problem after migration 8->9

    hi, im new in umbraco cms, so I cant find the solution. After migration from v8 to v9 out content picker throw excepiton:

    enter image description here

    when I set udi value - Its empty editor

    in v8 it works fine:

    enter image description here

    editors are created in js file dynamically ( based ona data we received ) below its scrap of code:

    js.file:

    var alContentPicker = {
                alias: 'alContentPicker',
                label: '',
                description: '',
                view: 'contentpicker',
                config: {
                    minNumber: 0,
                    maxNumber: 0,
                    multiPicker: '0',
                    filter: config.allowedTypes
                }
            };
    ...
    
    
    angular.forEach(config.columns.columns,
                    function (value, key)
    ....
    if (value.type === "contentpicker") {
                            var contentpicker = angular.copy(alContentPicker );
                            contentpicker.alias = contentpicker.alias + columnKey;
    
                            if (value.props.multiple) {
                                contentpicker.config.multiPicker = '1';
                            }
    
                            $scope.contentpickers["c" + columnKey] = contentpicker;
    
                            $scope.$watch('contentpickers["c' + columnKey + '"].value',
                                function (newVal, oldVal) {
                                    console.log($scope.contentpickers);
                                    if (newVal || newVal != oldVal) {
                                        $scope.rowdata[value.alias] = newVal.toString();
                                    }
                                });
    
                            if (editing === true) {
                                $scope.contentpickers["c" + columnKey].value = rowdata[value.alias].toString();
                            }
                        }
    

    html.file:

    umb-property-editor model="contentpickers['c'+$index]" ></umb-property-editor
    

    I will be grateful for any help

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Nov 14, 2021 @ 11:40
    Marc Goodson
    0

    Hi Roman

    I'm not sure if this of any help, but the error message talks about an issue converting an integer 5612 into type Umbraco.Cms.Core.Udi which is the unique guid key for identifying an item.

    Before Udi's were introduced the Content Picker would store the integer Id of the content item from the database - but the Udis were introduced to help with uniqueness between different Umbraco environments (eg for Umbraco Deploy).

    But both exist for backwards compatibility.

    So I'm not sure if something has changed in V9 but the Content Picker has a configuration option called idType that determines whether the Content Picker works with 'udis' or with integers...

    https://github.com/umbraco/Umbraco-CMS/blob/5bfab13dc5a268714aad2426a2b68ab5561a6407/src/Umbraco.Infrastructure/PropertyEditors/ContentPickerConfigurationEditor.cs#L29

    I guess here perhaps in V9 the default has switched to be Udis? and you need to add the idType config for your generated pickers?

    contentpicker.config.idType = 'udi';

    or the other way around!

    Said it might not be a helpful observation :-P

    Update.... Also saw this open issue... https://github.com/umbraco/Umbraco-CMS/issues/11631

    regards

    Marc

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Nov 17, 2021 @ 13:16
    Marc Goodson
    0

    Hi Roman

    Just to follow up on this... it's a bug in Umbraco 9.1RC / 9.1 release

    The workaround to create a new Macro Parameter Editor that supports Udi's is detailed here:

    https://github.com/umbraco/Umbraco-CMS/issues/11631#issuecomment-970148965

    Looks likely it will be fixed in a later 9.1.1 release.

    regards

    Marc

  • Roman Kalius 6 posts 76 karma points
    Dec 01, 2021 @ 08:24
    Roman Kalius
    0

    hi, the solution was to setup contentpicker.config.idType = 'udi' and to convert int's to uid in database. Thanx a lot for help

Please Sign in or register to post replies

Write your reply to:

Draft