2 Replies Latest reply on Jun 2, 2009 10:38 AM by lfred150

    Multiple Columns and List Order with Color

    lfred150

      I am trying to take this code and enhance it by:

       

      1. It currently displays the output in a 5 column vertical format

       

      output1 output2 output3...

       

      I want it to display in a scrolling 5 column vertical format

       

      output1  output4
      output2  output5
      output3  output6

       

      based on the number of data points

       

      2. I want the first column background to be blue, the next white, the next blue, the next white, the last blue.

       

      Any way to accomplish this..appreciate any help.

       

      Leo

       

      Code:

      <table width="100%" border="0" cellpadding="7" cellspacing="0">
      <tr>
      <td colspan="5" align="left" valign="top" bgcolor="#CC6699">
      <span class="datetextwhite"><a name="THURSDAY"> </a><span class="style6">Thursday, October 29th: PRE-CONFERENCE INTENSIVES</span></span></td>
      </tr>
           <TR>
           <CFOUTPUT QUERY="q_daysschedule">
                <TD valign=top><span class="bodytextbold"><span class="style16"><font face="Verdana, Arial, Helvetica, sans-serif">#q_daysschedule.time#</font></span></span><br /><span class="topNavigationBar"><a href="session.cfm?ID=201" class="topNavigationBar">#q_daysschedule.Title#</a></span></TD>
                <CFIF q_daysschedule.CurrentRow MOD 5 IS 0>
                     </TR>
                     <TR></TR>
                </CFIF>
           </CFOUTPUT>
      <tr>

        • 1. Re: Multiple Columns and List Order with Color
          Dan Bracuk Level 5

          I find these problems easier to solve if I rearrange my data into an array.  Something like this:

           

          DataArray = ArrayNew(2);

          Cols = 5;

          Outputs = "output1,output2,etc";

          Rows = Round(ListLen(Outputs) / Cols + .5);    // 32 outputs would give you 7 rows

           

          for (ii = 1; ii lt cols; ii = ii + 1) {

          for (j = 1; j lte Rows; j = j + 1) {

          DataArray[ii][j] = ListFirst(Outputs);

          Outputs = ListRestOutputs;

          } // rows

          }  // cols

           

          // Last Column

          for (ii = 1; ii lte ListLen(Outputs); ii = ii + 1 )

          DataArray[cols][ii] = ListGetAt(outputs, ii);

           

          // put spaces in blank rows

          for (j = ii; j lte rows; j = j + 1)

          DataArray[cols][j] = " ";

           

           

          Output like this

           

          <cfoutput>

          <cfloop from = "1" to = cols index = "ThisRow">

          <cfloop from = "1" to = rows index = "ThisCol">

          #DataArray[ThisCol][ThisRow]#

           

          closing tags, formatting etc

          • 2. Re: Multiple Columns and List Order with Color
            lfred150 Level 1

            The output is coming from a cfquery and this may not work (I may not understand the coding of that)..I really liked the simplicity of the code that I was using and did not know if there was a way to modify that to come up with my ultimate solution.

             

            Leo