Mark

Dont you just see that as firstly not re-usable at all and secondly extra
code for nothing.  You would have to apply that to every query to achive
that result

Personally I would go for a more re-usable approach by creating a UDF like
this

<cfscript>
        currentRowClass = "darkRowCol";
        function getRowClass()
                {
                if (currentRowClass EQ "darkRowCol")
                        {currentRowClass = "lightRowCol";}
                else
                        {currentRowClass = "darkRowCol";}
                return currentRowClass;
                }
</cfscript>


then all you need to do it this

<tr class="#getRowClass()#">

Doesnt matter how many times you call it, it will always switch for you, its
alot easier to code for and its much more re-usable

Regards
Steve Onnis



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Mark
Stanton
Sent: Wednesday, 12 November 2003 7:52 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: Coding Preference


I'm not a huge fan of mixing that sort of logic into your presentation. Sure
I've done it plenty of times before but increasingly I'm spending the effort
to get the data right before I start outputting.

In your case this would look something like:

<cfset queryAddColumn(q,'class',arrayNew(1))>
<cfloop query="q">
        <cfif q.currentRowMOD 2>
                <cfset querySetCell(q,'class','lightRowCol',q.currentRow)>
        <cfelse>
                <cfset querySetCell(q,'class','darkRowCol',q.currentRow)>
        </cfif>
</cfloop>

Then you don't need if's in your output.

Inefficient? Anal? Maybe, but I just find things easier to work with in the
long run when you start breaking it up this way.


Cheers

Mark


------------------
Mark Stanton
Technical Director
Gruden Pty Ltd
Tel: 9956 6388
Mob: 0410 458 201
Fax: 9956 8433
http://www.gruden.com


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004


---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to