Text input type in custom designer with value

Posted by: baloghbencefacebook on 25 October 2021, 2:58 am EST

    • Post Options:
    • Link

    Posted 25 October 2021, 2:58 am EST

    Hi!

    I created a text type input in the designer using the following object in the commandMap object:

    “something”: {

    “title”: “something”,

    “text”: “something”,

    “iconClass”: “something”,

    “commandName”: “something”,

    “type”: “text”,

    “execute”: null

    }

    Is there a way to give it a default value?

  • Posted 26 October 2021, 1:41 am EST

    Hi,

    For this, you need to return the value from the getState method. Please refer to the following code snippet and attached sample that demonstrates the same.

    
      config.commandMap = {
        cmdSaveData: {
          title: "Custom Text",
          type: "text",
          editorType: "text",
          bindingPath: "data",
          margin: "0 0 0 100px",
          commandName: "cmdSaveData",
          execute: async (context, propertyName) => {},
          getState: (context) => {
            return "value";
          }
        }
      };
    
    

    sample: https://codesandbox.io/s/spread-js-starter-forked-1tzzw?file=/src/index.js

    Regards,

    Avinash

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels