0

I have a growing SP2013 document library. In home page, I'm showing only the Name column. Now this results in just one long column on the left side of web part and an empty expanse on the right.

Is there a way I can show this single column in multiple columns? Like a List view in windows explorer?

I'm open for custom solutions too. Preferably client side (html,js) since I operate in a server restricted environment.

This is kinda what I'm looking for:

My Doc Library

Name Name Name
2

Here is a CSR that will do the job:

SP.SOD.executeFunc("clienttemplates.js", "SPClientTemplates", function() {
function getBaseHtml(ctx) {
    return SPClientTemplates["_defaultTemplates"].Fields.default.all.all[ctx.CurrentFieldSchema.FieldType][ctx.BaseViewID](ctx);
}

function RenderField(ctx, columnName) {
    var field = ctx.CurrentFieldSchema;
    var item = ctx.CurrentItem;
    var list = ctx.ListSchema;
    ComputedFieldRenderer(columnName);
    return ComputedFieldRenderField(ctx, field, item, list);
}

function init() {
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
        Templates: {
            Header: function(ctx) {
                return "<div style='white-space: nowrap'>";
            },
            Fields: {
                "LinkFilenameNoMenu": {
                    View: function(ctx) {
                        var rows = 10;
                        var str = "";
                        if ((ctx.CurrentItemIdx) % rows == 0){ 
                            str += "<div style='padding-right: 20px; display: inline-block; vertical-align: top'><span class='ms-vh2' style='padding-left: 0'>Name</span>";
                        };
                        str += "<div>" + RenderField(ctx, "LinkFilenameNoMenu") + "</div>";
                        if ((ctx.CurrentItemIdx + 1) % rows == 0){ 
                            str += "</div>";
                        };
                        return str;
                    },
                }
            },
            Footer: function(ctx) {
                return "</div>";
            }
        },
        ListTemplateType: 101
    });
}
RegisterModuleInit(SPClientTemplates.Utility.ReplaceUrlTokens("~siteCollection/Style Library/MultiColumn.js"), init);
init();

});

Assumptions:

  1. Only the column Name (linked to document) is visible
  2. Allow individual item checkboxes is unchecked

With var rows = ...; you can change the number of items in each column.

And that's how it looks like:

enter image description here

1

May be you can add two Document Library web parts to the page and split the content based on some criteria such as : Web part 1 to show items with ID 1 -100 and Web part 2 to show items with ID 100 onwards etc..

  • Thats a nice idea. I'll maybe set 2 filter conditions in each view and add it in. – PurpleShadow Aug 5 '16 at 20:45
0

There is out of the box method to show single column to max two columns by changing the default style to Document details style

  • Open Libray > from the above ribbon > click on modify the view > beside style select Document details.

enter image description here

  • You can also use items limit to use paging and allow show short list.

enter image description here

The Document details should be shown as the following

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.