Quantcast
Viewing all articles
Browse latest Browse all 6517

New Post: Contributing

Sorry for not replying straight away but here goes.
 $(".lock-peoplepicker").each(function() {
            var context = $(this);

            $().SPServices.SPFindPeoplePicker({
                thisRowFinder: function() {
                    return context;
                }
            }).contents.attr('contenteditable', 'false');
        });
In the situation above I'm using a peoplepicker in a custom page layout and I actually want to tell the SPFindPeoplePicker the "context/parent" where it can find the peoplepicker...which is normally a TR in NOBR in a standard form.

So what I did was to extend the SPFindPeoplePicker function with an option to use "my" context. It looks like this (btw I have done the same extension for the SPFindTaxonomyPicker).
    $.fn.SPServices.SPFindPeoplePicker = function(options) {

        var opt = $.extend({}, {
            peoplePickerDisplayName: "", // The displayName of the People Picker on the form
            valueToSet: "", // The value to set the People Picker to. Should be a string containing each username or groupname separated by semi-colons.
            checkNames: true, // If set to true, the Check Names image will be clicked to resolve the names
            thisRowFinder: undefined // Allows you to override how the 'thisRow' (i.e. context) variable will be located by supplying a function
        }, options);

        var thisRow;
        if (opt.thisRowFinder === undefined) {
            thisRow = $("nobr").filter(function() {
                // Ensures we get a match whether or not the People Picker is required (if required, the nobr contains a span also)
                return $(this).contents().eq(0).text() === opt.peoplePickerDisplayName;
            }).closest("tr");
        } else {
            thisRow = opt.thisRowFinder();
        } 

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>