Copied to clipboard

Flag this post as spam?

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


  • Iana 1 post 71 karma points
    1 week ago
    Iana
    0

    Workspace views - retrieve and save data

    I am trying to create a workspace view in which I will display and save contents of a data type. In this workspace I want the user to be able to read and modify the data.

    Inside my ts file, I have found a way to display the data using: getData()

    I have also found a way to display the data of a specific property ("Title") using: getPropertyValue("Title")

    but I want to be able to save this data and I don't see any example in the umbraco documentation nor in the umbraco source code in git hub.

    Here is the snippet of the code:

    import {
      LitElement,
      customElement,
    } from "@umbraco-cms/backoffice/external/lit";
    import { UmbElementMixin } from "@umbraco-cms/backoffice/element-api";
    import { UMB_CONTENT_WORKSPACE_CONTEXT } from "@umbraco-cms/backoffice/content";
    
    @customElement("c67-workspaceview")
    export default class WorspaceView extends UmbElementMixin(LitElement) {
      constructor() {
        super();
        this.consumeContext(UMB_CONTENT_WORKSPACE_CONTEXT, (nodeContext) => {
          var context = nodeContext;
          console.log("context.getData(): ", context.getData());
          var title = context.getPropertyValue("Title");
        });
      }
    }
    
    declare global {
      interface HTMLElementTagNameMap {
        "workspace-view": WorspaceView;
      }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft