SharePoint Branding Issues: Edit In Datasheet View

For a couple of weeks now, I’ve got some reports about crashing datasheet views when using custom master pages. As a reminder, the datasheet view is a view you can select when browsing within a list. It’ll enable you to view and edit the list in an excell-like format. Quite handy for bulk changes.

So, what is happening? I noticed the page was going into an infinite loop. When debugging I stumbled upon the GC-functions. Those functions are located in core.js and control the resizing of the datasheet view control. After carefull reviewing, I noticed the document.documentElement.scrollHeight was growing and growing. It seemed that my custom master page let the scroll height go out of it bounds.

To fix this, I simply bound the scroll height to the client height. To accomplish this, you look for

var lGCWindowHeight=document.documentElement.scrollHeight;

in core.js and replace it with

var lGCWindowHeight=(document.documentElement.scrollHeight>document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.documentElement.scrollHeight;

This seemed to solve the problem and stopped the browser from crashing.

But why was this happenning? My best bet is the use of a specific doctype in my masterpage. In quirks mode, IE includes top and bottom borders and padding widths when calculating the offsetheight. Standard mode only defines the content height as offsetheight. I’m guessing core.js relies on the extra margins. Now, the strange thing is, the custom master pages of MOSS (BlueBand, OrangeSingleLevel, …) do not experience this bug, altough they also use a specific doctype. I didn’t really investigate into it too much, but I suspect they restrict the height of some container surrounding the main content. This could stop the growth of offsetheight. If anyone of you, readers, can confirm this behaviour, feel free to respond in the comments.

In the meantime.. have fun branding!

Update: according to reader Rufino, you can also revert this behaviour by specifying a height. Didn’t test it yet, but I’m pretty sure this ‘ll do the trick too. Thanks Rufino!

4 Responses to “SharePoint Branding Issues: Edit In Datasheet View”

  1. Rufino Virata Says:

    Try specyfing a css sytle in your custom masterpage

    html, body
    {
    margin:0;
    padding:0;
    height:100%
    border:none;
    }

    That way you don’t have to modify the core.js
    –>Rufino

  2. Sharepoint Edit in Datasheet locks or freezes Internet Explorer « Cato Antonsen’s Weblog Says:

    [...] Josh Gaffey’s Blog [...]

  3. Recent Links Tagged With "masterpages" - JabberTags Says:

    [...] public links >> masterpages SharePoint Branding Issues: Edit In Datasheet View Saved by Luffy90 on Thu 09-10-2008 Unity IoC and ASP.NET Part II Screencast with Appearances by [...]

  4. Bookmarks about Branding Says:

    [...] - bookmarked by 5 members originally found by amott1973 on 2008-10-14 SharePoint Branding Issues: Edit In Datasheet View http://tomblog.insomniacminds.com/2008/07/23/sharepoint-branding-issues-edit-in-datasheet-view/ - [...]

Leave a Reply