Archive

Archive for the ‘Fixes’ Category

Fix "Render Failed" Error on Groupby View using Jquery

March 10, 2009 11 comments

I recently encountered this error “<!– #RENDER FAILED –&gt”.

image

I found the cause for it after searching and browsing various posts and comments about this error.

Cause:

Well it is a bug and hasnt been fixed anyway the below are the steps/combinations that cause it.

  1. Calculated Field from another list is being used as Lookup Column value in your list.
  2.  Group By the Look Up field (linked to Calculated Field in other List)
  3. Group Setting: Collapsed.

Solution: Apparently from the forums I visited turning Collapsed to Expanded in group setting fixes it and it does. Woo Hoo!.

But the problem is Collapsed setting is used to save real estate and this fix defeats that purpose.

image

Fixing with Group settings Collapsed

I had read about this Collapsing all Groups feature post at end user SharePoint  by Paul Grenier using Jquery and that seemed like a perfect candidate for this.  In This solution we shall turn Group setting to Expanded and use JavaScript to collapse on load.

Steps:
  1. Set the Group Setting to Expanded ( this will fix the error)
  2. Use the collapse all code Paul Grenier provides fire it during load.
    1. Add  Content Editor to the Page
    2. Click Edit Web Part and Add the Code below to Source Editor section of the Web Part and in Appearance Section select frame type as “None”.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type= "text/javascript">

</script>
<script type="text/javascript">
function collapseGroups() {
    $("img[src='/_layouts/images/minus.gif']:visible").parent().click();
}

_spBodyOnLoadFunctionNames.push("collapseGroups");
</script>

 

 

3. This will Collapse your Expanded Groups.

image

Done!

Issues with this method: I think in regular Group “Expand Collapse” SharePoint remembers your last collapse or group by setting. This script will ignores all that and collapses everything on Page Load

Now there are other ways to accomplish this.

  • Event handler instead of Calculated column to do the calculations and storing value in the field and use that field as look up.
  • JavaScript on Edit and New Form page, by adding  a new field and using Scripts to hide the field and populating them with calculated value (calculation done in the script). Click here to learn more