Solved

Global Variables in Lotus Notes 5 +  Designer

Posted on 2002-07-03
6
1,138 Views
Last Modified: 2013-12-18
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
0
Comment
Question by:mltolun
  • 3
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
Arunkumar earned 50 total points
ID: 7127676
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
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7127679
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
 
LVL 10

Expert Comment

by:zvonko
ID: 7127722
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:mltolun
ID: 7127974
It's ok...just ok
0
 
LVL 9

Expert Comment

by:Arunkumar
ID: 7128278
But a "B" is not okay for me you see ???

Hi Zvonko!
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7129202
(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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Creating and Printing a Barcode C# 1 800
Chinese chars 2 72
Domino Website - Redirection 12 84
problem with deleted user 14 28
You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question