Skip to main content
Known Participant
March 9, 2010
Question

how to break this in tabs

  • March 9, 2010
  • 1 reply
  • 360 views

hi below is my code whre i am getting data from query based on the id i grouped them and i need to do that divide these in to tabs.

here i pasted my code

<cfoutput query="qryAvailable" group="id">
                    <span style="float:left; font-weight:bold;">
                        <span style="width:140px; float:left;">#course_type_desc# Courses <br></span>                       
                    </span>
                    <div style="clear:both; line-height:0px; margin:0px !important; padding: 0px;"> </div>                   
                    <cfset selectedCourses = "">
                    <cfif structKeyExists(attributes, 'courseType' &id)>
                            <cfset selectedCourses = attributes['courseType' &id]>
                    </cfif>
                        <cfoutput>
                            <span class="row#Int(currentrow mod 2)#" style="float:left; width:575px; margin:0; padding:0;" >
                            <cfset checked = "" />
                            <cfif listcontains(selectedCourses,course_id)>
                                <cfset checked = 'checked="true"' />
                            </cfif>
                                <input type="checkbox" name="course_id" id="#course_id#" value="#course_id#" #checked#/>
                                  <label for="#course_id#">
                                      <span style="padding-left:5px;"> </span>
                                      #course_desc# (#course_id#)
                                </label>
                            </span>   
                            <div style="clear:both; line-height:0px; margin:0px !important; padding: 0px;"> </div>
                        </cfoutput>               
                    <span style="clear:both; line-height:0px; margin:0px !important; padding: 0px;"> </span>
                </cfoutput>

This topic has been closed for replies.

1 reply

Fernis
Inspiring
March 13, 2010

Your code example is somewhat messy... blech... inline css... No, Kenny, No!

Without having much clue what your query data still likes, something like this could do it:

Use cfoutputs with grouping to output the contents one group at a time.

Save each group output to a parameterizedly named variable with <cfsavecontent>

Count how many variables you created, so you know how many tabs you need to display.

Display the results using cflayout-tab, and looping as many cflayoutareas as you need.

<cflayout type="tab">

<cfloop from="1" to="#numberOfGroupsIHad#" index="t">

     <cflayoutarea title="Group #t#">

     #evaluate("mysavecontentvariable_#t#")#

     </cflayoutarea>

</cfloop>

See the bottom of http://blog.dasignz.com/blog/post/2008/08/CFLOOP-Vs-CFOUTPUT-with-a-query-attribute.aspx

Hope this helps even a bit.

-Fernis