JQuery Plugin Repository

Close Complete List of Plugins

toggleColumns  |  Category: Tables  |  Modified: 29 Oct 2009  |  Column filtering for large data tables.

This plugin indexes the columns of a specified table, along with the text in the th tags of the header row, and contructs a control of checkboxes with a direct association to each column. The user can then show and hide any column by simply checking and unchecking the associated checkbox.

Summary

Script File

jq.toggleColumns.js ( view )

Available Options

ctrlWrap

An HTML element that tells toggleColumns how to wrap the column manager. Options include any block-level element, such as:

  • div
  • form
  • p

Default value is "div".

leadText

A string used to label the control manager. Default value is "Show columns:".

disabled

An array specifying the columns (ordered by index, base 1) for which to disallow hiding. Default is none, denoted as an empty array, [ ].

initHide

An array specifying the columns (ordered by index, base 1) to hide on initial load. Default is none, denoted as an empty array, [ ].

Basic Usage

$("ELEMENT").toggleColumns();

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

Minimum Browser Support

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

Example

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

Associated Code

<script type="text/javascript">
$("#tblDemo").toggleColumns({
  leadText : "Display:",
  disabled :  [1],
  initHide :  [3,7]
  });
</script>

JQuery Plugin Repository | Home | Print

back to ksscholl.com