How to span a query into 2 columns

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default How to span a query into 2 columns

    I have a query that produces a list of products and some of those products are
    subdivided into groups within the list. I have a query that includes the
    'Group' feature to display the products that are subdivided by their group.
    This all works out fine but my problem is the list can be very long and I would
    like to span the query into two columns. Attached is my code. Can anyone help
    me?:confused;

    <div align="left">
    <table width="450" border="0" cellspacing="2" cellpadding="2">
    <tr>
    <th width="442" valign="top" scope="row"> <cfoutput><span
    style="font-weight: bold; font-size:
    larger;">#Recordset2.Products#</span></cfoutput><cfoutput query="Recordset1"
    group="Subtype">
    <div align="left" style="font-size: larger"> <br>#Recordset1.SubType#</div>
    <cfoutput>
    <div align="left"><span style="font-size:
    x-small">&nbsp;&nbsp;#Recordset1.Product#
    </span><br>
    </div>
    </cfoutput></cfoutput><br></th><tr> </tr>
    </table>
    <p><strong><span class="style11"><br>
    </span></strong></p>
    </div>

    CRC Guest

  2. Similar Questions and Discussions

    1. Arranging Query Columns
      This is my query <cfset Totals = queryNew("TotalPointsEarned,EarnedPointsCost,TotalPointsRedeemed,RedeemedPointsC...
    2. Span rows/columns?
      Is there a way to make a column in a grid span all the others? For instance I have fields Client, Address, State, City, Zip, Comments. I would...
    3. Specify Query Columns from From
      I want to create a form where a user can select from a drop down box which query colums they want to select and in what order. The form will be...
    4. displaying query in 2 columns
      Hi Guys, need your help on this please, I am trying to get the result of my query splited in 2 columns, where in the first column will have my first...
    5. DataGrid (body only) contained in <span>...</span> tags
      Hi, I have a DataGrid control that displays many records. As such, I have been given a requirement to contain only the body of my DataGrid...
  3. #2

    Default How to span a query into 2 columns

    I have a query that produces a list of products and some of those products are
    subdivided into groups within the list. I have a query that includes the
    'Group' feature to display the products that are subdivided by their group.
    This all works out fine but my problem is the list can be very long and I would
    like to span the query into two columns. Attached is my code. Can anyone help
    me? :confused;

    <div align="left">
    <table width="450" border="0" cellspacing="2" cellpadding="2">
    <tr>
    <th width="442" valign="top" scope="row"> <cfoutput><span
    style="font-weight: bold; font-size:
    larger;">#Recordset2.Products#</span></cfoutput><cfoutput query="Recordset1"
    group="Subtype">
    <div align="left" style="font-size: larger"> <br>#Recordset1.SubType#</div>
    <cfoutput>
    <div align="left"><span style="font-size:
    x-small">&nbsp;&nbsp;#Recordset1.Product#
    </span><br>
    </div>
    </cfoutput></cfoutput><br></th><tr> </tr>
    </table>
    <p><strong><span class="style11"><br>
    </span></strong></p>
    </div>

    CRC Guest

  4. #3

    Default How to span a query into 2 columns

    I have a query that produces a list of products and some of those products are
    subdivided into groups within the list. I have a query that includes the
    'Group' feature to display the products that are subdivided by their group.
    This all works out fine but my problem is the list can be very long and I would
    like to span the query into two columns. Attached is my code. Can anyone help
    me? :confused;

    <div align="left">
    <table width="450" border="0" cellspacing="2" cellpadding="2">
    <tr>
    <th width="442" valign="top" scope="row"> <cfoutput><span
    style="font-weight: bold; font-size:
    larger;">#Recordset2.Products#</span></cfoutput><cfoutput query="Recordset1"
    group="Subtype">
    <div align="left" style="font-size: larger"> <br>#Recordset1.SubType#</div>
    <cfoutput>
    <div align="left"><span style="font-size:
    x-small">&nbsp;&nbsp;#Recordset1.Product#
    </span><br>
    </div>
    </cfoutput></cfoutput><br></th><tr> </tr>
    </table>
    <p><strong><span class="style11"><br>
    </span></strong></p>
    </div>

    CRC Guest

  5. #4

    Default Re: How to span a query into 2 columns

    The parameter for spanning columns is "colspan". You want "colspan=2" on
    some rows.

    -brian

    "CRC" <webforumsuser@macromedia.com> wrote in message
    news:d07dsi$9a1$1@forums.macromedia.com...
    > I have a query that produces a list of products and some of those products
    are
    > subdivided into groups within the list. I have a query that includes the
    > 'Group' feature to display the products that are subdivided by their
    group.
    > This all works out fine but my problem is the list can be very long and I
    would
    > like to span the query into two columns. Attached is my code. Can anyone
    help
    > me? :confused;
    >
    > <div align="left">
    > <table width="450" border="0" cellspacing="2" cellpadding="2">
    > <tr>
    > <th width="442" valign="top" scope="row"> <cfoutput><span
    > style="font-weight: bold; font-size:
    > larger;">#Recordset2.Products#</span></cfoutput><cfoutput
    query="Recordset1"
    > group="Subtype">
    > <div align="left" style="font-size: larger">
    <br>#Recordset1.SubType#</div>
    > <cfoutput>
    > <div align="left"><span style="font-size:
    > x-small">&nbsp;&nbsp;#Recordset1.Product#
    > </span><br>
    > </div>
    > </cfoutput></cfoutput><br></th><tr> </tr>
    > </table>
    > <p><strong><span class="style11"><br>
    > </span></strong></p>
    > </div>
    >

    Brian Hogue Guest

  6. #5

    Default Re: How to span a query into 2 columns

    I apologize in advance for my inexperience, but where in my code do I put that. I tired putting it after 'scope='row'' but that did nothing...?
    CRC Guest

  7. #6

    Default Re: How to span a query into 2 columns

    You would use 2 cfloops, an outside one that would index the row every 2
    records and then 2 query loops inside that one, one for each <td>. So, every
    row you would add 1 to a Row_Number variable, which would add the required <tr>
    and </tr>, and also you would index 2 record variables by 2, which you would
    use to snag every other record from the database and add the <td>'s Like so
    <cfset Total_Rows = Total Records / 2 + 1> <cfset Row_Number = 1> <cfset
    Record_One = 1> <cfset Record_Two = 2> <cfloop condition='Row_Number less than
    Total_Rows'> <tr> <cfloop query='get_data' startrow='#Record_One#'
    endrow='#Record_One#'> <td> #Data# </td> </cfloop> <cfloop query='get_data'
    startrow='#Record_Two#' endrow='#Record_Two#'> <td> #Data# </td> </cfloop>
    <cfset Row_Number = Row_Number + 1> <cfset Record_One = Record_One + 2> <cfset
    Record_Two = Record_Two + 2> </cfloop>

    Tteddo Guest

  8. #7

    Default Re: How to span a query into 2 columns

    CRC -

    No need to apologize, most people need help in the beginning.

    Your question is really a HTML question, not a CF question. The tags for
    displaying a table are <table>, <tr> and <td>. The <td> "defines" the cell.
    Since you want one cell to span two columns, that HTML tag looks like <td
    colspan="2">.

    I am guessing that you want to span two columns in certain instances, and in
    other rows you want the two columns to appear. That sounds like some
    tweaking of any CFloop and CFoutput code that you have. Have you read Ben
    Forta's WACK?

    -brian


    "CRC" <webforumsuser@macromedia.com> wrote in message
    news:d07tcb$5ts$1@forums.macromedia.com...
    > I apologize in advance for my inexperience, but where in my code do I put
    that. I tired putting it after 'scope='row'' but that did nothing...?


    Brian Hogue Guest

  9. #8

    Default Re: How to span a query into 2 columns

    I got a response from an instructor of mine which solved my problem. Here is
    is response for future reference: I am assuming that you want to place the
    products into two column, e.g. Auto Dealers Auctions
    Franchised Auto Dealer Implement &amp; Equipment
    Motorcycle &amp; RV Dealership Trailer Dealers
    Used Car &amp; Truck Repair Shops Body &amp; Paint
    Mechanical Mobile Repair
    Muffler Radiator Wheel Alignment
    There are two approaches: 1 w/ tables, 1 w/ divs. Looking at your code, the
    div solution looks better: <CFOUTPUT query='Recordset1' group='Subtype'>
    <DIV align='left' style='font-size: larger'><BR>#Recordset1.SubType#</DIV>
    <CFOUTPUT> <DIV align='left; font-size: x-small; width:48%;
    float:left'> #Recordset1.Product#<BR> </DIV> </CFOUTPUT>
    </CFOUTPUT>

    CRC Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139