Copied to clipboard

Flag this post as spam?

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


  • Mikkel Johansen 114 posts 269 karma points
    May 09, 2017 @ 20:20
    Mikkel Johansen
    0

    Grid api - how do I CRUD grid-content via ContentService

    Is there a grid api?

    Is it possible to create/update/delete content in a grid with ContentService?

  • Tom 691 posts 908 karma points
    29 days ago
    Tom
    0

    Does anyone have an answer to this?

  • Søren Kottal 396 posts 2389 karma points MVP c-trib
    29 days ago
    Søren Kottal
    100

    There is no API, so you have to author the JSON yourself.

  • Tom 691 posts 908 karma points
    21 days ago
    Tom
    0

    Thanks Soren, My main issue is if you say for example use contentservice to get a property value from a grid and then set that value on another property that is a grid datatype it mangles the json so you can't copy grid values from one property to another.

    Is there a way around this?

    eg if you use something like GetPropertyValue for a grid data type and then use that value to set it on another grid data type via IContent content.SetValue(..., ...)

    it won't set it correctly and the grid value is invalid.

  • Søren Kottal 396 posts 2389 karma points MVP c-trib
    19 days ago
    Søren Kottal
    0

    Hi Tom

    I have used the ContentService for populating grid values a few times, but never ran into problems where the json got mangled. Can you give an example of what happened, and what you expected?

  • Tom 691 posts 908 karma points
    19 days ago
    Tom
    0

    enter image description here

    enter image description here

    I have some custom grid controls as well but I would think copying over json is copying over json.

  • Mario 80 posts 568 karma points c-trib
    18 days ago
    Mario
    0

    Hey Tom, are you using V7 or V8? Because I just tested your code in V8 and it worked ok.

  • Tom 691 posts 908 karma points
    18 days ago
    Tom
    0

    v7.8.1 at the moment

Please Sign in or register to post replies

Write your reply to:

Draft