|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
i have a <cfquery> that gets the following results
break NumOfBreaks Type date ----- - ---- ---- 1200 2 SOFT Monday 2940 4 SOFT Monday 4800 2 INT Monday 6540 4 SOFT .. 8400 2 SOFT .. since the query output changes depending on the date interval a user picks, i am trying to output this information in a table. so, the table will look like Monday Tuesday .... Sunday ---------------------------------------- 1200 | soft | | | | soft | | | --- ------------------------------------- | int | | | 2940 | int | | | | int | | | | int | | | ----------------------------------------- and so on, my problem is when i use the following code, the cells go all over the place, <cfoutput query="getResults"> <cfset rs = NumOfBreaks <tr> <th scope="row" rowspan="#rs#">#BreakTime#</th> <td > </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </cfoutput> does anyone know how to make this happen? i guess it has something to do with rowspan, but i couldnt figure it out yet. thanks in advance |
|
#2
|
||||
|
||||
|
For one, it's kind of strange to use TH for a sidebar since it's supposed to be a header.
Second, since you have the TH tag in the <cfoutput query=""> tag, it will be written for each row/result and thus screw up your table, especially since you have a rowspan on it but are only writing one row per record. Third, if you want a record count, use the queryName.recordcount property. If you're looking for the number of fields in your query, use the queryName.columnlist property. More on CF query variables I may not understand what you're trying to do, but it sounds like the best way to go about this would be to loop through the deliminated field list prior to looping through the query to get the headers (using TH), and then, in that query loop, again loop through the fields to create your dynamic table. |
|
#3
|
|||
|
|||
|
after i posted, i realized that the table i wanted to display got crashed. i know the recordcount, my problem is to display various rowspans. say with 1200 records i want two rows, with 1400 records i want four rows.
Monday| Tuesday| Wednesday|.. ..|Sunday|<p></p> 1200 |Soft | Int |........<p></p> |Int | Int |...<p></p> 1400 |Soft | Int |....<p></p> |Int | Soft |...<p></p> |Int | Soft |...<p></p> |Int | Soft |...<p></p> how do i change the number of rows on the second, third, fourth, .... dynamically depending on my recordcount? |
|
#4
|
|||
|
|||
|
unbeliviable,
if you can copy past the part with on your html editor you will see what i am trying to do. |
|
#5
|
||||
|
||||
|
if you want to make a output query with a dynamic number of table cells, go look at my sniplet of code in my topic titled "a tricky subject" if not please elaborate a little bit more what exactly you want to do........
|
|
#6
|
|||
|
|||
|
I see what you are trying to do. You're trying to create a table with a top header and a side header.
I would not go the route of a rowspan, simply because I've had to fix a lot of cross-browser rowspan issues in the past. Instead I would set up a regular table and the fields that are connected to 1200, but those that should not display 1200, I would find a way to enter a blank space. Possibly by doing an if statement that only displays the number in the first instance. So it would become: Monday Tuesday Wednesday .... ------------------------------------------------------- 1200 Soft Int Int Int Soft Int 1400 Int Soft Soft It may end up being too messy, but I'd have to know more about the data to come up with a better answer. |
|
#7
|
|||
|
|||
|
here is an example.
http://216.15.150.61/test9.cfm over here, i test for upto 4 counts. none of this is dynamic. see how i divide monday column for 00:20:00 into 2 rows and 00:49 into 4 rows? since my query results will be depending on the date interval and the network the user chooses, i need to make the number of rows dynamic. it will come from something like <cfquery name="getCount" datasource="Anatolia"> SELECT BreakTime, COUNT(BreakTime) AS BT FROM DenInt WHERE BreakDate BETWEEN '#FORM.startDate#' AND '#FORM.StopDate#' AND NetworkID = #FORM.selNet# GROUP BY BreakTime ORDER BY BreakTime </cfquery> so, getCount.BT is the number of rowspan. thanks for the help in advance. Bastion, it should give you an idea in terms of what type of data will be used. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Creating dynamic table but how? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|