FIRE JS-Funktion, wenn die Picker der Pause abgeschlossen sind
-
10-12-2019 - |
Frage
Gibt es eine Möglichkeit, eine JS-Funktion auszulösen, wenn ein Percess-Picker einen Benutzer abschließt und findet?Ich entwickle eine SharePoint 2013-App mithilfe von Client-Seite-Entwicklungsmuster.
Vielen Dank für Ihren Vorschlag generasacodicetagpre.
Lösung
On creation of the ClientPeoplePicker you can set the OnUserResolvedClientScript
property to a function like:
function MyPickerUserResolved (topElementId, users) {
// users is set to GetAllUserInfo()
}
Andere Tipps
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;
}
}