views:

96

answers:

2

I have seen a SharePoint list (Custom list) where text shows up, whenever a list is empty (only for some views). E.g. to inform users of the guidelines for the list usage.

How can this be implemented?

Ok with javascript/jquery solution

+2  A: 

For changing the message that appears for document libraries using jQuery:

// Change text for uploading documents
var docUploadRegexp = new RegExp();
docUploadRegexp.compile('(.+document\\slibrary\\.)(\\s+To\\screate.+\\.)', 'g');
$('table[class*=ms-listviewtable] > tbody > tr > td > table > tbody > tr > td[class*=ms-vb]:first-child').each(function(i, n) {
    var matches = $(n).text().match(docUploadRegexp);
    if (matches) {
     $(n).html(RegExp.$1);
    }
});

(Any suggestions on how to make it nicer very welcome - made community wiki.)

To make this work on a custom list, replace (.+document\\slibrary\\.) with (.+list\\.).

Alex Angas
Does this work for a custom list? Then intention is that in 2-3 views for a normal custom list a text should be displayed informing the users on how to use the list/content, only if the list is empty (sorry, not too much at home with jQuery yet ;o)
noesgard
+2  A: 
ArjanP
How du you get that dialog? (what selection)
noesgard
You need to Open the Page in SharePoint Designer and You will see a DataView WebPart, Right click Propertied.
Kusek
Your solution is good and easy to use but I'll accept the other solution because it's more flexible regarding what you can do with the output. Thx for the answer anyways!
noesgard