JQuery Plugin Repository

Close Complete List of Plugins

toggleTblSections  |  Category: Tables  |  Modified: 17 Jan 2011  |  Expand and collapse sections within data grids.

This plugin dynamically adds expand/collapse links to headings within the TBODY of data grids, allowing entire sections of the table to be hidden and revealed.

Summary

Script File

jq.toggleTblSections.js ( view )

Available Options

initialState

A string specifying whether the table sections should be "collapsed" or "expanded" (the default) when the page initially loads.

collapseText

A string used to specify text for the Collapse control link(s). Default value is "Collapse".

expandText

A string used to specify text for the Expand control link(s). Default value is "Expand".

showTotals

Boolean value specifying whether to include record totals in each section header. Default value is false.

Basic Usage

$("ELEMENT").toggleTblSections();

$("ELEMENT").toggleTblSections({ options });

Minimum Browser Support

  • Apple Safari 3
  • Google Chrome 1
  • Microsoft Internet Explorer 6
  • Mozilla Firefox 3
  • Opera 9

Example 1

This example exhiibits the default (expanded) settings.

Name Rank Position SSN DOB
Name Rank Position SSN DOB
Command Personnel
Houlihan, Margaret Major Head Nurse 234-56-7890 11/04/1937
Pierce, Benjamin Captain Chief Surgeon 678-90-1234 01/28/1936
Potter, Sherman Colonel Commanding Officer 789-01-2345 04/15/1915
Medical Personnel
Burns, Frank Major Surgeon 012-34-5678 09/29/1939
Hunnicut, BJ Captain Surgeon 901-23-4567 02/06/1939
Nakahara, Kellye Lieutenant Nurse 890-12-3456 01/02/1950
Winchester, Charles Major Surgeon 123-45-6789 10/31/1932
Support Personnel
Staff Personnel
Klinger, Maxwell Corporal Clerk 345-67-8901 07/01/1934
Mulcahy, Francis Lieutenant Priest 567-89-0123 10/20/1932
O'Reilly, Walter Corporal Clerk 456-78-9012 05/24/1940

Associated Code

<script type="text/javascript">
$(document).ready(function() {
  $("#tblDemoE").toggleTblSections();
  });
</script>

Example 2

This example collapses the sections on the initial page load, specifies the text on the control links, and displays record totals for each section.

Name Rank Position SSN DOB
Name Rank Position SSN DOB
Command Personnel
Houlihan, Margaret Major Head Nurse 234-56-7890 11/04/1937
Pierce, Benjamin Captain Chief Surgeon 678-90-1234 01/28/1936
Potter, Sherman Colonel Commanding Officer 789-01-2345 04/15/1915
Medical Personnel
Burns, Frank Major Surgeon 012-34-5678 09/29/1939
Hunnicut, BJ Captain Surgeon 901-23-4567 02/06/1939
Nakahara, Kellye Lieutenant Nurse 890-12-3456 01/02/1950
Winchester, Charles Major Surgeon 123-45-6789 10/31/1932
Support Personnel
Staff Personnel
Klinger, Maxwell Corporal Clerk 345-67-8901 07/01/1934
Mulcahy, Francis Lieutenant Priest 567-89-0123 10/20/1932
O'Reilly, Walter Corporal Clerk 456-78-9012 05/24/1940

Associated Code

<script type="text/javascript">
$(document).ready(function() {
  $("#tblDemoC").toggleTblSections({
    initialState : "collapsed",
    collapseText : "Hide Details",
    expandText   : "Show Details",
    showTotals   :  true
    });
  });
</script>

JQuery Plugin Repository | Home | Print

back to ksscholl.com