vLookup inline Editing People-Picker

Forums vLooup for SharePoint vLookup inline Editing People-Picker

Viewing 1 reply thread
  • Author
    Posts
    • #27521
      Brett
      Participant

      Hi Alexander,
      This is a follow up from the comment here:
      https://spjsblog.com/2019/08/31/vlookup-inline-editing-examples/#comment-318334

      I have been trying to get this working for days, I just can’t get the value of the People Picker when I click the green tick.
      The following is the code I am using and you can see the result in the animated GIF attached.
      PLease note:
      I have used the Field type single line of text example as a template.
      I added var ppid to handle multiple People Picker elements in the vLookup.

      // Field type people-Picker
      function edit_inline_pp(val, id, listGuid, fin) {
          var ppid =  "pp" + id ;
          var dVal = val, b = [];
          if (dVal === "") {
              dVal = "Click to add name";
          }
          b.push("<div style='white-space:nowrap;' >");
          b.push("<div class='vLookupDispWrap' onclick='toggleEditField(this);' >");
          b.push("<span class='vLookupCurrVal' > " + dVal + " </span>");
          b.push("</div>");
          b.push("<div class='vLookupEditWrap' >");
          b.push("<div id='" + ppid + "' onkeydown='event.stopPropagation()' style='height:22px' >");
      //display people picker
           function showPP() {
              var schema = {};
              schema.PrincipalAccountType = 'User,DL,SecGroup,SPGroup';
              schema.SearchPrincipalSource = 15;
              schema.ResolvePrincipalSource = 15;
              schema.AllowMultipleValues = false;
              schema.MaximumEntitySuggestions = 50;
              schema.Width = '200px';
              schema.Height = '50px';
              this.SPClientPeoplePicker_InitStandaloneControlWrapper( ppid  , null, schema);
          }
          setTimeout(function(){
              showPP();
          },250); 
      //get People Picker value   
         function getPPvalue(){
              var ppid =  "pp" + id ;
                  var pp = SPClientPeoplePicker.SPClientPeoplePickerDict.ppid_TopSpan, users = pp.GetAllUserInfo(), arr;
                  // Get current PP values
                  arr = [];
                  jQuery.each(users,function(i,o){
                      arr.push(o.Key);
                  });
      //not sure if this is correct?
                   val = (JSON.stringify(arr));
                 b.push("<input type='text' value='" + val + "'>");
              }
         b.push("</div>");
          b.push("<span title='Save' style='cursor:pointer;margin:3px;color:green;font-weight:bold;' onclick='saveChangesInput(this,\"" + fin + "\",\"" + id + "\",\"" + listGuid + "\")'>✔</span>");
          b.push("</div>");
          b.push("</div>");
          return b.join("");
      }

      Any questions just ask,
      Thanks.

      • This topic was modified 2 weeks, 5 days ago by  Alexander Bautz. Reason: Fixed code snippet
    • #27560
      Alexander Bautz
      Keymaster

      I have made some changes to your code example and posted it here: https://spjsblog.com/2019/08/31/vlookup-inline-editing-examples/#People_picker_field

      Alexander

Viewing 1 reply thread
  • You must be logged in to reply to this topic.