SharePoint 2013 calendar displays different colors according to category

Source: Internet
Author: User

Recently there is a small need, is the SharePoint calendar type list, users want to according to the category in the event, in the foreground view to display a different color, racked their brains, think of such a method, share to everyone, hope there is a better way to message recommend to me.

Effects, such as:

Different category of event, foreground display background color is not the same;

Principle

By analyzing the foreground HTML of the calendar view, it is found that all the events are in a Div, and the Div class is the same, so it is easier to use jquery to get all the event's Div.

Another layer of view, Div under the title of the link, there is the ID of the event, through the JS parse out this ID is not difficult, so, according to the ID with ECMAScript to obtain the category of the event also become feasible, You can then change this event's outermost div background color.

Based on the value of the ID, use the ECMAScript script to go to the SharePoint calendar to read the category value, and then according to the value of the outermost div to the corresponding background color, below, the use of the JS script, give everyone a reference.

Advantages

Currently testing, perfect support add and delete after the asynchronous load, support the day view, the Week view, the monthly view of the various switches, support the expansion and contraction of the project too much folding is the asynchronous load occurred;

Disadvantages

Orange Is the default color, because the ECMAScript script is asynchronous, so the change will have a gradient effect, such as, you can see the change is a gradual process, but also very pleasing, hehe.

Other sounds

In the process of making this calendar, also see some other solutions, rewrite the calendar view is not mentioned, see Erucy in SharePoint 2010, the link, but found that the month view is not subtitle, so no way to achieve, there is the calendar overlap function, link I also attached, Let's see for yourselves.

Reference documents

Http://www.cnblogs.com/erucy/archive/2010/09/20/2416097.html

Http://www.cnblogs.com/yunliang1028/archive/2012/02/15/2352766.html

SharePoint 2013 calendar displays different colors according to category

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.