<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.atitd.org/wiki/t5w/index.php?action=history&amp;feed=atom&amp;title=Help%3ACollapsing</id>
	<title>Help:Collapsing - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://www.atitd.org/wiki/t5w/index.php?action=history&amp;feed=atom&amp;title=Help%3ACollapsing"/>
	<link rel="alternate" type="text/html" href="http://www.atitd.org/wiki/t5w/index.php?title=Help:Collapsing&amp;action=history"/>
	<updated>2026-04-04T21:04:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>http://www.atitd.org/wiki/t5w/index.php?title=Help:Collapsing&amp;diff=44&amp;oldid=prev</id>
		<title>Kartal: Created page with &quot;'''NOTICE:''' This Page has been copied Directly from [http://en.wikipedia.org/w/index.php?title=Help:Collapsing  Wikipedia's Collapsing Tables Help Files]Under the [http://en.wi...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.atitd.org/wiki/t5w/index.php?title=Help:Collapsing&amp;diff=44&amp;oldid=prev"/>
		<updated>2010-08-07T01:36:36Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;NOTICE:&amp;#039;&amp;#039;&amp;#039; This Page has been copied Directly from [http://en.wikipedia.org/w/index.php?title=Help:Collapsing  Wikipedia&amp;#039;s Collapsing Tables Help Files]Under the [http://en.wi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''NOTICE:''' This Page has been copied Directly from [http://en.wikipedia.org/w/index.php?title=Help:Collapsing  Wikipedia's Collapsing Tables Help Files]Under the [http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License Creative Commons Attribution License  ]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Collapsible tables''' provide a way to collapse and uncollapse a table when a show/hide button is clicked.  The code for this feature is found in the [[MediaWiki:Common.js]].&lt;br /&gt;
&lt;br /&gt;
The initial state of any collapsible content can be controlled using a &amp;quot;collapsible table&amp;quot;, because it also allows a table with only one element with content, and a header.&lt;br /&gt;
&lt;br /&gt;
==Simple example==&lt;br /&gt;
Tables are simpler to work with, as you merely need to add the '''&amp;lt;tt&amp;gt;collapsible&amp;lt;/tt&amp;gt;''' class to the table itself. For the [hide]/[show] link to appear, the table's first row must be a header row, that is, one of the cells in the first row must be declared with an exclamation mark (in wikisyntax). The use of the class &amp;lt;tt&amp;gt;wikitable&amp;lt;/tt&amp;gt; in the example below is merely for appearance; it is not needed for &amp;lt;tt&amp;gt;collapsible&amp;lt;/tt&amp;gt; to function.&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable style=&amp;quot;width:80%;&amp;quot; align=center&lt;br /&gt;
!Code entered!!Output produced&lt;br /&gt;
|-&lt;br /&gt;
|width=50%|&amp;amp;#32;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{| class=&amp;quot;wikitable &amp;lt;/nowiki&amp;gt;'''collapsible'''&amp;quot;&lt;br /&gt;
 '''!'''&amp;lt;nowiki&amp;gt; Simple collapsible table&lt;br /&gt;
|-&lt;br /&gt;
| Lorem ipsum dolor sit amet&lt;br /&gt;
|}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center;&amp;quot;|&lt;br /&gt;
{| class=&amp;quot;wikitable collapsible&amp;quot;&lt;br /&gt;
! Simple collapsible table&lt;br /&gt;
|-&lt;br /&gt;
| Lorem ipsum dolor sit amet&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Using the syntax above, collapsible tables are often used to always display an introduction to, or summary of, a lengthy discussion or section of content, while hiding the majority of that content from immediate view.  The summary message is put in the header cell, and the content is placed into the body cell.  The content is then easily accessible by clicking the 'show' button.  The collapsible functionality is also available in larger and more complicated tables, as long as there is a header cell in the first row of the table.&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable style=&amp;quot;width:80%;&amp;quot; align=center&lt;br /&gt;
!Code entered!!Output produced&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:50%; font-size:90%&amp;quot;|&amp;amp;#32;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{| class=&amp;quot;wikitable &amp;lt;/nowiki&amp;gt;'''collapsible'''&amp;lt;nowiki&amp;gt;&amp;quot;&lt;br /&gt;
 |A normal cell in the header row&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;'''!'''&amp;lt;nowiki&amp;gt; colspan=&amp;quot;2&amp;quot;| Header cell spans two cols&lt;br /&gt;
 |-&lt;br /&gt;
 | colspan=&amp;quot;2&amp;quot; | Lorem ipsum dolor sit amet&lt;br /&gt;
 | Separate body cell&lt;br /&gt;
 |}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center;&amp;quot;|&lt;br /&gt;
{| class=&amp;quot;wikitable collapsible&amp;quot;&lt;br /&gt;
|width=33%|A normal cell in the header row&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot;| Header cell spans two cols&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | Lorem ipsum dolor sit amet&lt;br /&gt;
|width=33%| Separate body cell&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Collapsing tables by default==&lt;br /&gt;
Just using the &amp;lt;tt&amp;gt;'''collapsible'''&amp;lt;/tt&amp;gt; class produces a table which is expanded by default, but can be collapsed by the reader.  It is also possible to create tables which are ''collapsed'' by default, and can be optionally ''expanded''.  There are several methods for doing this, depending on the situations in which you want the table to collapse. &lt;br /&gt;
&lt;br /&gt;
==='collapsed'===&lt;br /&gt;
Adding the &amp;lt;tt&amp;gt;'''collapsed'''&amp;lt;/tt&amp;gt; class will cause the table to ''always'' be initially collapsed, no matter what happens around it.  It is the simplest method for doing so.  Using the examples above:&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable style=&amp;quot;width:80%;&amp;quot; align=center&lt;br /&gt;
!Code entered!!Output produced&lt;br /&gt;
|-&lt;br /&gt;
|width=50%|&amp;amp;#32;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{| class=&amp;quot;wikitable &amp;lt;/nowiki&amp;gt;'''collapsible collapsed'''&amp;quot;&lt;br /&gt;
 '''!'''&amp;lt;nowiki&amp;gt; Simple collapsible table&lt;br /&gt;
|-&lt;br /&gt;
| Lorem ipsum dolor sit amet&lt;br /&gt;
|}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center;&amp;quot;|&lt;br /&gt;
{| class=&amp;quot;wikitable collapsible collapsed&amp;quot;&lt;br /&gt;
! Simple collapsible table&lt;br /&gt;
|-&lt;br /&gt;
| Lorem ipsum dolor sit amet&lt;br /&gt;
|}&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;width:50%; font-size:90%&amp;quot;|&amp;amp;#32;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{| class=&amp;quot;wikitable &amp;lt;/nowiki&amp;gt;'''collapsible collapsed'''&amp;lt;nowiki&amp;gt;&amp;quot;&lt;br /&gt;
 |A normal cell in the header row&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;'''!'''&amp;lt;nowiki&amp;gt; colspan=&amp;quot;2&amp;quot;| Header cell spans two cols&lt;br /&gt;
 |-&lt;br /&gt;
 | colspan=&amp;quot;2&amp;quot; | Lorem ipsum dolor sit amet&lt;br /&gt;
 | Separate body cell&lt;br /&gt;
 |}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center;&amp;quot;|&lt;br /&gt;
{| class=&amp;quot;wikitable collapsible collapsed&amp;quot;&lt;br /&gt;
|width=33%|A normal cell in the header row&lt;br /&gt;
! colspan=&amp;quot;2&amp;quot;| Header cell spans two cols&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; | Lorem ipsum dolor sit amet&lt;br /&gt;
|width=33%| Separate body cell&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==='autocollapse'===&lt;br /&gt;
Adding the &amp;lt;tt&amp;gt;'''autocollapse'''&amp;lt;/tt&amp;gt; class causes the table to collapse when there are more than a threshold number of collapsible tables on the page. On en.wiki, this threshold is set at 2. The example below, therefore, collapses because there are numerous collapsible tables on the page.&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable style=&amp;quot;width:80%;&amp;quot; align=center&lt;br /&gt;
!Code entered!!Output produced&lt;br /&gt;
|-&lt;br /&gt;
|width=50%|&amp;amp;#32;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{| class=&amp;quot;wikitable &amp;lt;/nowiki&amp;gt;'''collapsible autocollapse'''&amp;quot;&lt;br /&gt;
 '''!'''&amp;lt;nowiki&amp;gt; Simple collapsible table&lt;br /&gt;
|-&lt;br /&gt;
| Lorem ipsum dolor sit amet&lt;br /&gt;
|}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center;&amp;quot;|&lt;br /&gt;
{| class=&amp;quot;wikitable collapsible autocollapse&amp;quot;&lt;br /&gt;
! Simple collapsible table&lt;br /&gt;
|-&lt;br /&gt;
| Lorem ipsum dolor sit amet&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==='innercollapse' and 'outercollapse'===&lt;br /&gt;
Using this pair of classes, it is possible to make a table collapsed by default only when it is ''contained within'' a particular object, such as another table. This is mainly useful for tables inside templates, which are often nested.&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable style=&amp;quot;width:80%;&amp;quot; align=center&lt;br /&gt;
!Code entered!!Output produced&lt;br /&gt;
|-&lt;br /&gt;
|width=50%|&amp;amp;#32;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{| class=&amp;quot;wikitable &amp;lt;/nowiki&amp;gt;'''outercollapse'''&amp;lt;nowiki&amp;gt;&amp;quot;&lt;br /&gt;
! This table does not collapse&lt;br /&gt;
|-&lt;br /&gt;
| But the table inside this cell&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable &amp;lt;/nowiki&amp;gt;'''collapsible innercollapse'''&amp;lt;nowiki&amp;gt;&amp;quot;&lt;br /&gt;
! Does collapse&lt;br /&gt;
|-&lt;br /&gt;
| Hiding this part&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center;&amp;quot;|&lt;br /&gt;
{| class=&amp;quot;wikitable outercollapse&amp;quot;&lt;br /&gt;
! This table does not collapse&lt;br /&gt;
|-&lt;br /&gt;
| But the table inside this cell&lt;br /&gt;
{| class=&amp;quot;wikitable collapsible innercollapse&amp;quot;&lt;br /&gt;
! Does collapse&lt;br /&gt;
|-&lt;br /&gt;
| Hiding this part&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Other notes==&lt;br /&gt;
===Sortable tables===&lt;br /&gt;
Collapsible tables can be combined with the [[Help:Sorting|sortable tables]] functionality without difficulty.  However, because the hide/show button is placed in the first header cell located, its positioning can look a bit peculiar if the table is not wide enough:&lt;br /&gt;
&lt;br /&gt;
{| class=wikitable style=&amp;quot;width:80%;&amp;quot; align=center&lt;br /&gt;
!Code entered!!Output produced&lt;br /&gt;
|-&lt;br /&gt;
|width=50%|&amp;amp;#32;&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;{| class=&amp;quot;wikitable &amp;lt;/nowiki&amp;gt;'''collapsible sortable'''&amp;lt;nowiki&amp;gt;&amp;quot;&lt;br /&gt;
!Name!!Score&lt;br /&gt;
|-&lt;br /&gt;
|John||59&lt;br /&gt;
|-&lt;br /&gt;
|Jane||100&lt;br /&gt;
|-&lt;br /&gt;
|Bob||72&lt;br /&gt;
|}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|style=&amp;quot;width:50%; text-align:center;&amp;quot;|&lt;br /&gt;
{|class=&amp;quot;wikitable sortable collapsible&amp;quot;&lt;br /&gt;
!Name!!Score&lt;br /&gt;
|-&lt;br /&gt;
|John||59&lt;br /&gt;
|-&lt;br /&gt;
|Jane||100&lt;br /&gt;
|-&lt;br /&gt;
|Bob||72&lt;br /&gt;
|}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Customization===&lt;br /&gt;
Registered users can edit [[Special:MyPage/monobook.js|their monobook.js]] file to change some of the variables used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=javascript&amp;gt;&lt;br /&gt;
autoCollapse = 4 //how many collapsible tables on the page before autocollapse works (default=2)&lt;br /&gt;
var collapseCaption = 'collapse' //text of the [hide] link (default='hide')&lt;br /&gt;
var expandCaption = 'uncollapse' //text of the [show] link (default='show')&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kartal</name></author>
	</entry>
</feed>