Archive

Posts Tagged ‘Business Connectivity Services’

#SP2010 Group List Items by External Data field–Field Display Missing #in

November 17, 2010 2 comments

On an intranet I have been working on recently I came across a bug where the display of an External Data field in the 1st and 2nd level grouping is not shown when grouping by the BCS based item(s).

To provide a short term fix I created the following JavaScript to run on the page to solve the problem.

1 <script type="text/javascript"> 2 3 _spBodyOnLoadFunctionNames.push("updateGroupNameValues_Level1"); 4 5 function updateGroupNameValues_Level1() 6 { 7 $('TBODY[id*=titl]').each(function() 8 { 9 var currentGroupString = unescapeProperly(($(this).attr("groupstring"))); 10 currentGroupString = currentGroupString.replace(';', ''); 11 var groupStringArray = currentGroupString.split("#"); 12 var groupLevel1 = groupStringArray[1]; 13 var groupLevel2 = groupStringArray[2]; 14 15 var currentSpan = $(this).find("span").text(); 16 var newSpan; 17 if (groupLevel2 == "") 18 { 19 newSpan = groupLevel1 + " " + currentSpan; 20 $(this).find("span").text(newSpan); 21 22 } 23 else 24 { 25 newSpan = groupLevel2 + " " + currentSpan; 26 $(this).find("span").text(newSpan); 27 } 28 29 //alert("groupLevel1: " + groupLevel1 + " | groupLevel2: " + groupLevel2); 30 //alert(($(this).children("span").html())); 31 }); 32 } 33 34 </script> 35

Essentially the values do exist in the DOM / HTML, but they are not displayed in the tags presented by the grouping.

NB: Please be aware that this solution relies upon JQuery.

%d bloggers like this: