Rather than having the message "no documents found" show up on your otherwise customized view, use this JavaScript code to replace those words with whatever text or HTML you desire. This is especially useful in dynamic views, which show a single category in which the category may or may not be present, depending on the logic of the computed category.
Add this code to $$ViewTemplateDefault form or any method through which you display views on the Web. Put this function in the jsheader area of your form.
function checkDocs(){
var v = document.getElementById('view');
if(v){
var pos=v.innerHTML.toLowerCase().
indexOf("<h2>no documents
found</h2>")
if (pos>=0){
v.innerHTML = '<computed text here
or what ever html you want
to appear rather than no documents found>';
}
}
}
Add this to the body tag of the form onLoad="checkDocs()". Finally, wrap the ViewBody in a div tags as follows:
start div: <DIV id="view">
end div: </DIV>
Do you have comments on this tip? Let us know.
This tip was submitted to the SearchDomino.com tip exchange by member Daron Lawing. Please let others know how useful it is via the rating scale at the end of the tip. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.