Solved

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

Posted on 2014-02-01
2
240 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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 …

856 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