User name by default in editor field value.

User name by default in editor field value.

BalaKrishnanDhanuskodiBalaKrishnanDhanuskodi Posts: 45Questions: 17Answers: 0

Happy Morning All,

Trying to built an issue log within the developing system using datatable, so an exclusive issue manger table is created and incorporated.

Please find the exhibit on screen where I need to insert user details by default.

Tried and understood 'ipOps' and I assume this is only for "type:select" is there something similar for "type:text".

Wishing you Most and more...
Bala.

This question has an accepted answers - jump to answer

Answers

  • Rob BrunRob Brun Posts: 56Questions: 2Answers: 14
    edited October 2017 Answer ✓

    Hi BalaTest, If you have access to the users name, I think that you can set it in the initCreate event. Like

      editor.on('initCreate', function (e) {
         editor.field("myField").val(userName); 
      });
    

    Or maybe in the def property of your field object like

     {
          label: "Issue Raised By :",
          name: "IssueRaiser",
          def: username
    },
    

    Personally, if the user's name is a global variable and you are using REST I like to set it in the data of the create

      ajax: {
         create: {
            type: 'POST',
            url: 'createIssueMethodUrl',
            data: { "UserName": userName}
          }
      }             
    

    Shay

  • BalaKrishnanDhanuskodiBalaKrishnanDhanuskodi Posts: 45Questions: 17Answers: 0
    edited October 2017

    Thanks Shay for various options,

    I was comfortable with

    {
          label: "Issue Raised By :",
          name: "IssueRaiser",
          def: username
    },
    
    

    Works perfect...

This discussion has been closed.