Solved

ColdFusion How can I indent my table results with related records?

Posted on 2014-02-01
2
235 Views
Last Modified: 2014-03-01
How can I indent my table results:

                                        Search results:
                                                                           Ordered 40  Received 45
                      (show related records                    Overage   Return 5
                         under main record with indent)                            



How can I implement a + for the viewer to click, to view the related records? (normally hidden)
0
Comment
Question by:DJPr0
2 Comments
 
LVL 4

Assisted Solution

by:Jack Leach
Jack Leach earned 100 total points
ID: 39826737
I haven't used ColdFusion with an Access database, and am unsure quite how those two work together, but what you're suggestion sounds like a Treeview control.  Have you looked into one?  ASP.NET has a nice implementation of a web-hostable treeview, but I'm unsure of others offhand.
0
 
LVL 4

Accepted Solution

by:
Rodrigo Munera earned 400 total points
ID: 39828669
It's pretty simple, and usually handled with CSS and possibly jQuery.

I'm assuming you're starting with a query? When you're outputting the query data you would want to group the data and tag the sub-data with a named class or set of classes. A table might not be your best way of displaying this data since the data might not be tabular in nature.

So, let's say you have a query with customers and their orders. Each customer has a unique customer ID and each order has a unique order ID, your query would order the data by customerID and then by orderID. then you can nest your outputs by group and hide/show them on demand.

<!-- Make sure you have a query library in the <head> of your document for the .toggle() function to work -->
<style>
.hidden{
display:none;
}
</style>
<table>
  <cfoutput query="orders" group="CustomerID">
    <tr><td>#customerID# #name# etc... <button onclick="$('##Customer_#CustomerID#').toggle();"> + </button></td></tr>
      <cfoutput group="OrderID">
        <tr id="Customer_#CustomerID#" class="hidden"><td>#OrderID# #OrderDate# etc...
          <cfoutput group="OrderItems">
            <div><td>#itemID# #Units# #Total# etc...</td></div>
          </cfoutput>
        </td></tr>
      </cfoutput>
  </cfoutput>
</table>

Open in new window

0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now