Results 1 to 2 of 2
  1. #1
    maas is offline Member
    Join Date
    Jul 2010
    Rep Power

    Default Show group header above each displayed table

    Dear team,

    I need your assistant and help in solving the issue while displaying the records in a table. I am looking for a group header to be placed above each printed table for its related category and subcategory, as well as, the no. of the records for each table to be shown at the top of the table.

    The table contains columns for category, subcategory, name. ex:

    Category Subcategory Name

    CON Retail AAA

    CON Wholesale BBB

    SPEC Retail CCC

    What I am looking for is the below layout:

    Category/Subcategory (No. of records) –similar to a group header

    Name – Country ..etc ----Table header

    table records

    Here is my code below:
    Java Code:
    //Retrieve the values from the DB
    while (
    //to compare the existing category with the previous one and to display group header
    if ((category_name1).equals(temp_category_name) )
    <%=category_name1%> / <%=subcategory_name1%> <%=count%>  //Currently it is showing duplicate values many times and the count is wrong
                                    if (!(subcategory_name1).equals(temp_subcategory_name) )
    <table width="80%">
                                                    <th> Name</th>
                                                    <th>Country </th>
    The problem in the above code is that it is showing the group headers category & sub ctageory multiple times and the count is incorrect. So, please assist me in correcting the above one.

  2. #2
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Rep Power

    Default Re: Show group header above each displayed table

    The problem is you did not fectch data in ordered format of category and sub category. You can alter your query like "order by category , sub ctageory" so that you may not get too many headers. I hope it would also resolve your count problem as well.
    (Living @ Virtual World)

Similar Threads

  1. Groupable table header - not able to sort
    By new2java2009 in forum New To Java
    Replies: 2
    Last Post: 07-08-2011, 10:49 PM
  2. Best way to model table with header characters?
    By doa24uk in forum New To Java
    Replies: 1
    Last Post: 07-01-2011, 02:44 PM
  3. How to change the height of a table header?
    By Zelord in forum AWT / Swing
    Replies: 2
    Last Post: 12-20-2010, 09:08 PM
  4. DisplayTag Table header styling problem and paging
    By selvi in forum Web Frameworks
    Replies: 0
    Last Post: 08-05-2010, 09:14 AM
  5. Updating Displayed Table Rows
    By raycini in forum JavaServer Faces (JSF)
    Replies: 2
    Last Post: 04-20-2009, 09:24 AM

Posting Permissions

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