Friday, February 27, 2015

How to disable client side people picker using JQuery in SharePoint 2013 | SharePoint Online

Problem

I had created SharePoint people picker using the example from msdn in my aspx page. I had to disable people picker through JQuery in order to full fill my client’s requirement.

Solution

According to above mentioned msdn post people picker is initiated on.

  1. <div id="peoplePickerDiv"></div>

So the id of the div is peoplePickerDiv. So with that I will show the solution.

Step 1:

Create an object of people picker.

  1. var peoplePicker = this.SPClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerDiv_TopSpan;

Step 02:

Set Enable state to fasle.

  1. peoplePicker.SetEnabledState(false);

This will disable the people picker. But you can remove the people objects with X sign. So in Step three we have to remove X.

Step 03:

Remove the X image.

  1. $('#peoplePickerDiv_TopSpan_ResolvedList').find('.sp-peoplepicker-delImage').hide();

Conclusion

Now the people picker is disabled.

image

Thursday, February 12, 2015

Link a column of a list other than the title to DispForm.aspx in SharePoint 2013

Problem

I had created a custom SharePoint list through Visual Studio 2013. I had added another column. I need this column to be linked to display form of the item. By default title field is linked to display form.

Solution

The solution is simple

  1. Open the Schema.xml of Listimage
  2. Search for your field under <Fields> tag.
  3. Add LinkToItem="TRUE" as a property.

image

Conclusion

Now you can click on your field and navigate to the display form.

Here is the visual studio solution:

https://drive.google.com/file/d/0ByEnOE8DAdvhdV80Y3ZCQzh0TkE/view?usp=sharing