Solved

Global Variables in Lotus Notes 5 +  Designer

Posted on 2002-07-03
6
1,128 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now