Here is a small javascript function, which allow you to set background color to rows for the view table generated by Domino.
function setColors(objTable, Color1, Color2) {
var trs = objTable.firstChild.childNodes;
var Colors = [Color1, Color2];
for(var i=1; i<trs.length; i++) {
trs[i].style.backgroundColor = Colors[i % 2]
}
}
The above function applies to flat/categorized views. There are other functions floating around to do the same job, but they fail for categorized views. That technique uses the document.getElementByTagName(“TR”), where the categorized entry has
inside it.How can i use this function:
-
Put the above function into JSHeader.
-
call it from onLoad event of the form.
Ex: setColors(document.getElementById(‘divViewTable’).getElementsByTagName(‘TABLE’)[0], ‘#000000’, ‘#999999’)
To call this function, we need 3 parameters:
- objTable: This is the reference to the table generated by Domino for view. You can count the
The otherway is to put the embedded view/viewBody inside a div tag and use divName.getElementsByTagName(“TABLE”)[0].
-
Color1: named color or #RGB
-
Color2: named Color or #RGB.
With R6, you may not need this function. But with prior versions, this is so helpful.
I’ve some more functions like changing row colors on MouseOver, MouseOut, Click, opening document by double click (aka Notes Client), Tool Tip etc. If you need them, please let me know. So that i can post them as a response.
HTH
Adi