A Faster jQuery Preview Pane

A while back there was a post on EndUserSharePoint.com by Paul Grenier that described how to use jQuery and the CEWP to make a preview pane.  I thought it was a very nice solution and worked better than the out of the box preview pane SharePoint uses.  

Too Much Code

The only issue is the preview pane solution is that in environments with slow internet connections the preview pane will be almost as slow as if the user actually broswed to the display form for the item.

Although its done through AJAX jQuery is still having to load the whole DispForm.aspx and then only displaying the contents of  a specific element.  DispForm.aspx when rendered through the borwser (like most pages in SharePoint) is very code heavy with over 700 lines of code ( An Announcement List item). Reducing the amount of code jQuery has to load from the diplay form will decrease load times and make everyone happy.


Gabe Hilado and I decided to try to make it faster. The simple solution is to make your own diplay form in SharePoint Designer. First we tried creating a blank .aspx page and putting the list view webpart on it.  The reduced the amount of code on the page but I wanted it to be even faster.

The next step was to use a dataview webpart only displaying the fields we needed for the preview. The result was a page with under 100 lines of code (varies based on the item legnth). 

Below is the modified javascript.

<script src=<a href="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js">http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js</a>" type="text/javascript"></script>
<script type="text/javascript">
function handleError() { //fn needed for IE
return true;
function jLoadMe(t) {//load content

$("#jLoadMe").load(t+" .ms-formtable", function(result,status,xhr) {
$("#jLoadMe h3").css("font-size","8pt");
function initjLoadMe() {//initialize page
var arrayList = $("a[href*='DispForm.aspx']");
$.each(arrayList, function(i,e){
var t = $(e).attr("href");
t = t.replace('DispForm.aspx','empty.aspx');
$(e).hover(function() {jLoadMe(t)});
$(function() {
window.onerror = handleError; //needed for IE
function jLoadEdit(t) {//load content
$("#jLoadMe&quot;).load(t+" .editForm",  function(result,status,xhr) {
$("#jLoadMe h3").css("font-size","8pt");

<div id="jLoadMe" class="content"></div>

What’s going on

The code has been modified so that onhover instead of calling DispForm.aspx it calls empy.aspx. However when the item title is clicked the browser will nagivate to the traditional DispForm.aspx.


Dave is a SharePoint developer and graphic designer based in the DC area.

One thought on “A Faster jQuery Preview Pane

Leave a Reply

Your email address will not be published. Required fields are marked *