Copied to clipboard

Flag this post as spam?

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


  • Gayathri 55 posts 175 karma points
    Jan 16, 2018 @ 09:13
    Gayathri
    0

    Custom Property Editor returns object Umbraco

    i am trying to create a custom Property Editor in Umbraco

    Package.manifest

    {
        propertyEditors: [
            {
                alias: "Notification Ribbon",
                name: "Notification Ribbon",
                editor: {
                    view: "~/App_Plugins/NotificationRibbon/NotificationRibbon.html"
                }          
            }
        ],
        javascript: [
            '~/App_Plugins/NotificationRibbon/NotificationRibbon.controller.js'
        ]
    }
    

    and in my controller

    a

    ngular.module("umbraco").controller("NotificationRibbon.Controller", function($scope) {
        $scope.opennotification = function() {
    
            if (!$scope.control) {
                $scope.control = {}
            }
            if (!$scope.model) {
                $scope.model = {}
            }
    
    
            $scope.overlay = {
                title: "Nottification ribbon",
                view: "/ultradata/Views/common/overlays/notificationribbon/notificationribbon.html",
                rteeditor: $scope.model.value.rteeditor,
                NotifyLinkClass: $scope.model.value.NotifyLinkClass,
                Location: $scope.model.value.Location,
                ButtonValue: $scope.model.value.editModel,
                show: true,
                submit: function(model) {
                    $scope.overlay.show = false;
                    $scope.overlay = null;
                    $scope.model.value = {};
                    $scope.model.value.rteeditor = model.rteeditor.value;
                    $scope.model.value.NotifyLinkClass = model.NotifyLinkClass;
                    $scope.model.value.Location = model.Location;
                    $scope.model.value.ButtonValue = model.ButtonValue;
    
                },
                close: function(oldModel) {
                    $scope.overlay.show = false;
                    $scope.overlay = null;
                }
            }
    
        }
    
    });
    

    the Property editor value storing like this for example in server

    {
            "id": 19151,
            "alias": "not",
            "value": {
                "rteeditor": "<p>fghfhfghfgh</p>"
            }
        }
    

    when i tried to take the value and display the notification Text value in Razor code

    <div class="gayaaa">@Umbraco.Field("not")</div>
    

    the Result returning the Entire object in Screen

    enter image description here

  • Alex Skrypnyk 6162 posts 24132 karma points MVP 8x admin c-trib
    Jan 24, 2018 @ 22:29
    Alex Skrypnyk
    0

    Hi Gayathri

    The property editor stores all $scope.model.value object

    So all fields that you added to $scope.model.value will be in database

    /Alex

  • Alex Skrypnyk 6162 posts 24132 karma points MVP 8x admin c-trib
    Feb 06, 2018 @ 22:37
    Alex Skrypnyk
    0

    Hi Gayathri

    Did you find a solution?

    Share with community, please

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft