2

I have a document library web part on a page that I would like to change the default message"There are no documents in this view." to something else. The solution needs to be applied to a certain document library web part when there's more that one document library web part on the same page. I tried everything but was unsuccessful. However, I was able to change the default message for a list when it's empty.

1

You could use CSR for this requirement.

Sample demo:

SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
            Templates: {
                Footer: function (ctx) {
                    var rows = ctx.ListData.Row;
                    if (rows.length<1)
                        return String.format("<div>There are no documents in this view.</div>");
                    else
                        return String.format("<div></div>"); 
                }
            }
        });

enter image description here

  • The solution you provided is great however, it's being applied to all web parts on the page. How can I apply the solution to a particular web part? Perhaps using the Title? – Ikaika Jul 30 '19 at 13:54
  • ctx contains a wpq property, you could use it to identify the list view parent, check this demo sharepoint.stackexchange.com/questions/266444/… – Lee_MSFT Jul 31 '19 at 0:50

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.