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 Answer
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>");
}
}
});
-
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?– IkaikaCommented Jul 30, 2019 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/…– LeeCommented Jul 31, 2019 at 0:50