I would use a UDF if I used CF5 all the time. :)

---------- Original Message ----------------------------------
From: "Billy Cravens" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Date: Tue, 29 Jan 2002 16:34:14 -0600

Yeah, DE() is really slow.  Personally, I just use a UDF:

<cfscript>
function bgColor(expression,color1,color2) {
    if (expression) {
        return color1;
    } else {
        return color2;
    }
}
</cfscript>

then in my html:

<tr bgcolor="#bgColor(currentRow MOD 2,"silver","white")#">

You can use the UDF for pretty much any situation you need to conditionally
change row color - just evaluate to boolean:

<tr bgcolor="#bgColor(myIncome GT 0,"green","red")#">

----- Original Message -----
From: "Jeremy Ridout" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 29, 2002 1:42 PM
Subject: RE: Toggle table row color


> Maybe. I really dont remember. I just know that there was definately a
> specific case where iif() was not a good solution. And, since I kept
having
> to look up the proper syntax of iif(), I just gave up on it and used the
> cfif/cfset method.
>
> Thanks!
> Jeremy
>
> -----Original Message-----
> From: Ron Mast [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 29, 2002 1:37 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Toggle table row color
>
>
> I think I know what your thinking about Jeremy.  Isn't it the difference
> between using <cfoutput> and <cfloop>?  I just thought I would throw this
> out since I remember vividly having to change my IIF command when using
> <cfoutput> or <cfloop>.  If the IIF works in <cfoutput> then it won't work
> in <cfloop> and vice versa.  Sorry, if I'm wrong.
>
> Ron
>
> -----Original Message-----
> From: Jeremy Ridout [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 29, 2002 1:33 PM
> To: '[EMAIL PROTECTED]'
> Subject: RE: Toggle table row color
>
>
> Hmmm... I don't have a specific case in mind (because I dont use that
method
> anymore). But I remember cases when outputting with <cfoutput
> query="queryName" group="columnName">, if the rows were displayed in an
> order that was not in currentRow order, they would be jumbled. Now that I
> look at it, however, I can't remember what it was, and I look at
currentRow
> as well. Maybe it was grouped and subgrouped output? Matters.
>
> Just be aware that there is more than one way to skin this cat and if one
is
> unsatisfactory in a particular situation, there are always alternatives.
>
> Jeremy
>
>
> -----Original Message-----
> From: Clint Tredway [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 29, 2002 1:17 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Toggle table row color
>
>
> I use the IIF command with grouped output without a problem.
>
> ---------- Original Message ----------------------------------
> From: Jeremy Ridout <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Date: Tue, 29 Jan 2002 13:21:24 -0600
>
> Here is what I use...
>
> <table>
> <cfoutput query="queryName">
>
> <cfif queryName.CurrentRow MOD 2 is 1>
> <cfset TheColor = "#000000">
> <cfelse>
> <cfset TheColor = "FFFFFF">
> </cfif>
> <tr valign="top" bgcolor="###TheColor#">
> <td></td>
> </tr>
>
> </cfoutput>
> </table>
>
> I don't mean to spank on the other suggestions, but the IIF method fails
if
> you are grouping your output. The other method requires you to duplicate
> (retype) the row & data.
>
> Jeremy
>
>
>
> -----Original Message-----
> From: phumes1 [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 29, 2002 12:57 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Toggle table row color
>
>
>
> Hi,
>
> Anyone have any code that can toggle the color of each row within a table
> being generated from a database?
>
>
> -------------------------------------------------------------------------
> This email server is running an evaluation copy of the MailShield anti-
spam
> software. Please contact your email administrator if you have any
questions
> about this message. MailShield product info: www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
>
> -------------------------------------------------------------------------
> This email server is running an evaluation copy of the MailShield anti-
spam
> software. Please contact your email administrator if you have any
questions
> about this message. MailShield product info: www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
>
>
> -------------------------------------------------------------------------
> This email server is running an evaluation copy of the MailShield anti-
spam
> software. Please contact your email administrator if you have any
questions
> about this message. MailShield product info: www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
>
> -------------------------------------------------------------------------
> This email server is running an evaluation copy of the MailShield anti-
spam
> software. Please contact your email administrator if you have any
questions
> about this message. MailShield product info: www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
>
> -------------------------------------------------------------------------
> This email server is running an evaluation copy of the MailShield anti-
> spam software. Please contact your email administrator if you have any
> questions about this message. MailShield product info: www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
>
> -------------------------------------------------------------------------
> This email server is running an evaluation copy of the MailShield anti-
> spam software. Please contact your email administrator if you have any
> questions about this message. MailShield product info: www.mailshield.com
>
> -----------------------------------------------
> To post, send email to [EMAIL PROTECTED]
> To subscribe / unsubscribe: http://www.dfwcfug.org
>

-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org


-------------------------------------------------------------------------
This email server is running an evaluation copy of the MailShield anti-
spam software. Please contact your email administrator if you have any
questions about this message. MailShield product info: www.mailshield.com

-----------------------------------------------
To post, send email to [EMAIL PROTECTED]
To subscribe / unsubscribe: http://www.dfwcfug.org

Reply via email to