Copied to clipboard

Flag this post as spam?

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


  • kris 13 posts 54 karma points
    Aug 27, 2014 @ 10:30
    kris
    0

    Saving data in a custom property editor

    Morning All,

    I've created a custom property editor in 7.1.6 and I don't understand how this data is saved (and how it is store in the umbraco database) when the 'Save and Publish' button is clicked.

    Can anyone enlighten me please?

    Regards

    Chris

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Aug 28, 2014 @ 13:37
    Jan Skovgaard
    1

    Hi Kris

    Do you mind sharing your code with us? It might make it a bit easier to point out how it works...but let's try and see if I can explain this properly anyway :)

    When you create a property on your document type using your custom datatype/property editor then it has a model.

    So if you in your view write something like {{model.alias}} it should return the chosen alias for you. If you write {{model.value}} it should return the saved value.

    In your controller you tell it to use $scope and since angularjs is all about 2-way databinding you can update your model by simply writing

    $scope.model.value ='I'm a text';
    

    So when you hit save in Umbraco the value is saved in the database.

    I hope this makes sense?

    Some good ressources for learning angularjs and angularjs in an Umbraco context follow below.

    https://angularjs.org/ https://github.com/umbraco/AngularWorkbook http://umbraco.github.io/Belle/#/api https://www.codeschool.com/courses/shaping-up-with-angular-js

  • kris 13 posts 54 karma points
    Aug 29, 2014 @ 14:54
    kris
    0

    Hi Jan,

    Thanks very much for this it really helps.

    I'm going to have a go at this now if I have any issues i'l post up my code.

    Thanks for the resource links as well.

    Cheers buddy,

    Chris

  • Nekesh 13 posts 103 karma points
    Jun 15, 2016 @ 06:28
    Nekesh
    0

    I am saving selected data in json format in umbraco db. I want to retrieve the data in UI with their name. How can we do that?

    Thanks in advance..

Please Sign in or register to post replies

Write your reply to:

Draft