Tag Archives: JavaScript Templating

JavaScript Templating with SharePoint 2013 (Part 3)

Update: I’ve since converted this template to a configurable web part. See http://www.lestersconyers.com/birthdays-and-anniversaries/ for latest.

Welcome to Part 3 of JavaScript Templating. In this post we will use the SharePoint 2013 Search API to build a Birthdays web part based on user profile data. And my procrastination worked for the good because today is actually my birthday! As in the last post I will be using jQuery to retrieve data and Handlebars to build my HTML.

The Finished Product

I’ll be building a template the renders upcoming birthdays. The display is based on Facebook’s birthday reminders. And as an added bonus, we’ll allow you to post a “Happy Birthday” message to the birthday boy’s (or girl’s) news feed.
birthdays list

Continue reading

JavaScript Templating with SharePoint 2013 (Part 2)

Welcome to Part 2 of JavaScript Templating with SharePoint 2013. In part 1 I tried to lay a foundation for the next posts. If you haven’t read it, I’d suggest you at least breeze over it so this post makes a little more sense.

As I mentioned in the first post, generally speaking when it comes to JavaScript templating there are 3 players involved: a data source, a data retrieval mechanism, and a template. I also mentioned that we SharePoint developers should also keep in mind that our code should be able to exist on any page the user chooses.

As with the remaining posts in this series, jQuery ajax will be my data retrieval mechanism and I’ll use Handlebars as my templating engine. In this post I’m going to leverage a SharePoint list named Events as my data source.

The Finished Product

Below are some screenshots of the finished product. The template lists upcoming events. Clicking the event title reveals more details.

Collapsed

Events

Expanded

events_expanded

Continue reading

JavaScript Templating with SharePoint 2013 (Part 1)

After a very long hiatus I am back hoping to contribute to the SharePoint community. It’s been too long. Today I want to touch on a subject that is getting much traction in the MVC and front end development realm: JavaScript templating. These developers have been quick to utilize client-side templating to build slick and user friendly applications. Beauty is nice but the major benefit is a no-brainer: increase performance due to a decrease in response payloads.

Although the benefits are awesome and obvious, the presence of client-side templating is rare in the SharePoint space, I don’t see it very much. I don’t even hear it talked about often. Let me say that I’m not dissing any one. I’ve been known to revert back to server side web parts in a New York minute. I think several SharePoint developers do the same. It’s because that’s what we’re comfortable with. It’s what we’ve done in SharePoint for years and it works over and over again. It’s like tradition! But a wise man once said “It’s also a tradition that times must and always do change my friend.” [2 bonus points to whoever can name that movie!]

This will be part 1 of a 4 part series involving JavaScript templating. In this post I’m going to lay a foundation for the next 3 posts. This one is heavy on text. The others will be heavy on screenshots and code…I promise!

Continue reading