Global Variables in Lotus Notes 5 + Designer

I want to design a VIEW, for the web, with alternate row colors. (ex. first blue, second white, and so).
How do I do this?? In Lotus Script??

Thanks
mltolunAsked:
Who is Participating?
 
ArunkumarConnect With a Mentor Commented:
Two options, courtesy of Advisor Media (advisor.com):

************************************************************
+ ADVISOR TIP: Add Alternate Row Colors to Web Views
- Domino 5x/4.6 (Issue ELN010212)
============================================================
Have you ever wanted to use the Alternate Rows color effect
available in Lotus Notes views in Web views?

One way would be to use @DocNumber to identify odd- and even-
numbered rows and change the color accordingly.

However, @DocNumber is special text that can't be used
directly, and can't be converted to a usable number with
@functions.

Here is a JavaScript example showing how to gain access to
the @DocNumber value, perform a modulo, and change the color
of alternating rows. In the first column of the view, just
put this code in the column's formula.

"SCRIPT>( ("+@DocNumber("") + "%2) == 1)?document.write(\"<TD
BGCOLOR=#FFEFCE>\"):document.write(\"<TD BGCOLOR=#FFFFFF>\"); </SCRIPT>]" +
SomeFieldName + "/TD>]"

--Dan Allensworth, Sheboygan, Wisconsin

Editor's Note: Putting this code into a view column overrides
any formatting Domino would apply to the column, such as font
size and color. It also overrides Domino's ability to display
the column entries as links. Therefore, add your own <FONT>
tags to format "SomeFieldName". And, if you need links in the
column, add your own <A href> tags. Great tip!

************************************************************
+ ADVISOR TIP: Display Web Views with Alternating Row
Colors: Revisited (Issue ELN010423)
- Domino 5x
- Microsoft Internet Explorer 5x/4x
============================================================

A recent Advisor Tip showed how to create alternate colors
for Web view rows using @DocNumber. Because Domino
increments @DocNumber regardless of whether the user can
see the document, this won't work for documents that contain
Readers fields. Here's an all JavaScript solution that works
for all situations.

In the HEAD part of the $$ViewTemplate form
for your view enter this code:

<SCRIPT TYPE="text/javascript"> var count=0;
//Sets "count" to be a global variable. </SCRIPT>

I use a StyleSheet to control the colors of my
alternate rows. The StyleSheet could look like this:

<STYLE>
.Even{
background-color: #FFFFFF;
}
.Odd{
background-color: #CCCCCC;
}
</STYLE>

In the first column of the view:

"<SCRIPT> var color; if(count%2){ document.write
(\'<TR CLASS=Odd>\'); } else{ document.write
(\'<TR CLASS=Even>\'); };count++</SCRIPT>"

The rest of your columns can be whatever you want
to display. I also set "Treat document contents
as HTML" for the form and "Treat view contents as
HTML" for the view.

--Joacim Boive

Regards,
Don

0
 
ArunkumarCommented:
Alternate row color for web views - Easy solution
Posted by David Frahm on 19.Mar.01 at 10:48 AM using a Web browser
Category: Domino Designer -- ViewsRelease: All ReleasesPlatform: All Platforms
 
I've seen a lot of examples on how to get this to work, since the regular Notes view property doesn't work on the web, just in the Notes client. However, they were all too complicated and some required that the view property "Treat view contents as HTML" to be enabled.

Below is my attempt to devise a simple, easy-to-implement solution. It works whether the view is categorized or not. As a bonus, it also changes the column header cells to have a gray background just like in the Notes client.

On the $$ViewTemplateDefault form, place the following code in the JS Header section:
function transformView() {
var tableElements = document.getElementsByTagName('table') ;
// alert('tableElements.length = ' + tableElements.length) ;
var table = tableElements[tableElements.length - 1] ; // change this value if the view table is not the last table on the page, this varies depending on how you layout your $$ViewTemplateDefault form
// table.width = '100%' ; // spreads out the table if you want it to
table.cellSpacing = '0' ; // removes space between cells

headers = table.getElementsByTagName("th") ;
for( i = 0; i < headers.length; i++) {
headers[i].bgColor = '#cccccc' ;
}

rows = table.getElementsByTagName("tr") ;
var counter = 0
for( i = 0; i < rows.length; i++) {
rows[i].bgColor = (i % 2 ? '#efefef' : '') ;
}

}

Also, you must call the above function by placing the following code into the HTML Head Content section:
"onLoad=\"transformView()\""

Caveats
This does not work if the view is categorized and has the View > Style property lines per row set to anything other than 1.

The example above is for R5 but could easily work in R4 by utilizing the appropriate $$ fields (which I don't remember because its been too long :-)).

By the way, if you have trouble with the column headings not aligning correctly with the column contents, this is corrected by disabling the View > Options property "Show response documents in a hierarchy". This should only be needed when there are no response documents in the view, so disabling the property in order to fix the display should not cause any problems.
0
 
zvonkoCommented:
And here my two pence:)

Place this in first column that should alternate:
"[</td></tr><SCRIPT>(("+@DocNumber("") + "%2) == 1)?document.write(\"<TR BGCOLOR=#FFEFCE><td colspan=3>\"):document.write(\"<TR><td colspan=3>\");</SCRIPT>]"+SomeFieldName



Cheers,
zvonko


0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
mltolunAuthor Commented:
It's ok...just ok
0
 
ArunkumarCommented:
But a "B" is not okay for me you see ???

Hi Zvonko!
0
 
zvonkoCommented:
(Hi Bro :)

Hello mltolun,

it is obvious that your question title and question body do not match together. And your feedback make this confusion complete.
The work Arun and I invested to provide a solution for you should be at least worth some kind words.
And when you are grading keep in mind that this gradings are multiplications for our expert points. This is not a big problem for us but for you when you again have such a confuse question :)

This what I just said to you can be read following the link below about Comments&Answers.

'till next time,
zvonko

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.