سؤال

هل هناك طريقة لتشغيل وظيفة JS عندما يكمل People Picker ويجد للمستخدم؟أقوم بتطوير تطبيق SharePoint 2013 باستخدام نمط تطوير جانب العميل.

شكرا لاقتراحك لكل، لقد حاولت إضافة onuserresolvedclescript في عنصر التحكم على النحو التالي ولكن لا يعمل، لست متأكدا مما إذا كان بإمكاني إضافةه بهذه الطريقة؟ giveacodicetagpre.

هل كانت مفيدة؟

المحلول

On creation of the ClientPeoplePicker you can set the OnUserResolvedClientScript property to a function like:

function MyPickerUserResolved (topElementId, users) { 
    // users is set to GetAllUserInfo()
} 

نصائح أخرى

You could use some jQuery to identify when the field on the page changes. The DIV for the people picker will have plain text for items not yet checked (i.e. if you typed a name, but didn't hit check names) and a span for each item that it has checked.

Here are some examples of how to monitor a DIV like that: https://stackoverflow.com/questions/4979738/fire-jquery-event-on-div-change

This function work on Internet Explorer for me:

function MyPickerUserResolved (topElementId, users) {                    
  //prevent users == null
  if(users.length != 0){
    var UserManager = users[0].Description;
    alert(UserManager); // show message contains on user position 1;
  }
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top