By default it’s not possible to group your list items by contenttype. After some research on internet I founded a solution on codeplex:
SharePoint 2010 ViewEdit Group By Content Type
Actually it’s nothing more than adding some javascript with a script link to each page.
Add the following js code to a separate file (I called it ListViewEdit.js)
Add a custom action to add the scriptlink on each page in SharePoint
Deploy the solution and enjoy the group by content type!
SharePoint 2010 ViewEdit Group By Content Type
Actually it’s nothing more than adding some javascript with a script link to each page.
Add the following js code to a separate file (I called it ListViewEdit.js)
Code Snippet
- _spBodyOnLoadFunctionNames.push("jbCTFix");
- function jbCTFix() {
- jbCTKludge('idGroupField1');
- jbCTKludge('idGroupField2');
- }
- function jbCTKludge(selName) {
- var sel = document.getElementById(selName);
- if (sel) {
- if (sel.selectedIndex >= 0) {
- var o = document.createElement('option');
- o.text = 'Inhoudstype';
- o.value = 'tp_ContentType';
- var prev = sel.options[sel.selectedIndex];
- try {
- sel.add(o, prev);
- }
- catch (ex) {
- sel.add(o, sel.selectedIndex);
- }
- }
- }
- }
Add a custom action to add the scriptlink on each page in SharePoint
Code Snippet
- <?xml version="1.0" encoding="utf-8"?>
- <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
- <CustomAction Id="Ribbon.Library.Actions.Scripts"
- Location ="ScriptLink"
- ScriptSrc="~site/_layouts/VMW_Intranet/js/ListViewEdit.js" />
- </Elements>
Deploy the solution and enjoy the group by content type!
Geen opmerkingen:
Een reactie posten