Copied to clipboard

Flag this post as spam?

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


  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 11, 2014 @ 16:41
    Ismail Mayat
    0

    Prevalue save issue

    I am having a save issue with my property editor prevalue. I have the following prevalue:

                prevalues: {
                fields: [
                    {
                        label: "Indexes",
                        description: "Index to search on",
                        key: "index",
                        view: "~/App_Plugins/Similarity/views/indexes.html",
                        validation: [
                            {
                                type: "Required" 
                            }                       
                        ]
                    }
    

    My view looks like

    <div class="umb-editor umb-checkboxlist" ng-controller="similarity.indexController">
        <div>           
            <select ng-model="model.config.index" class="umb-editor umb-dropdown" ng-options="o for o in indexes">              
            </select>
        </div>
    

    and my controller looks like

    angular.module("umbraco").controller("similarity.indexController",
        function ($scope, indexResource) {
    
            //get the indexes from /umbraco/backoffice/api/SimilarityApi/GetIndexes
            indexResource.getAllIndexes().then(function(response){
    
                $scope.indexes= response.data;
    
            })
        });
    

    The prevalue stuff all loads fine my drop down is populated and I can select a value however when I save it does save however it does not restore the picked value. I am missing something obvious, any ideas?

    Regards

    Ismail

  • Comment author was deleted

    Feb 11, 2014 @ 16:44
    ng-model="model.config.index"
    change to
    ng-model="model.value


    prevalue editor doesn't know about model.config , you use that in the prop editor to access the value

  • Comment author was deleted

    Feb 11, 2014 @ 16:45

    damn formatting

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 11, 2014 @ 16:46
    Ismail Mayat
    0

    Tim,

    Even if you have more than one custom prevalue? Does angular know model.value is only for that specfic prevalue type? I am assuming it is.

    Regards

    Ismail

  • Comment author was deleted

    Feb 11, 2014 @ 16:47

    So see it as a prop editor first it's just storing a value, if you then use it as a prevalue editor you can fetch the value with the key 

  • Comment author was deleted

    Feb 11, 2014 @ 16:50

    Yeah just handle it as a prop editor, it's the config options on a prop editor that define the key but the prevalue editor doesn't need to know about the key it's just storing a value

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 11, 2014 @ 16:52
    Ismail Mayat
    0

    Tim,

    So for each prevalue editor i can have

    model.value.somevalue1 //works on my dropdown

    model.value.somevalue2 //does not work on my multiselect

    etc etc

    Regards

    Ismail

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Feb 11, 2014 @ 16:56
    Ismail Mayat
    0

    The view for the multi select controller looks like

    <div class="umb-editor umb-select" ng-controller="similarity.docTypeController">
        <div>           
            <select ng-model="model.value.docTypes" class="umb-editor umb-dropdown" ng-options="docType.documentTypeAlias for docType in docTypes" multiple="true" ng-multiple="true">              
            </select>
        </div>
    

  • Comment author was deleted

    Feb 12, 2014 @ 13:39

    why do model.value.docTypes ?

  • Comment author was deleted

    Feb 12, 2014 @ 13:43

    AS a tip, try to make it work as a prop editor first, then use it as a prevalue editor

Please Sign in or register to post replies

Write your reply to:

Draft