<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web 3.0, 6 Bladed Razors, 7 Minute Abs &#187; Expandable</title>
	<atom:link href="http://www.zachleat.com/web/tag/expandable/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zachleat.com/web</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 17:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Enlarging your YUI DataTable in 29 Seconds or Less!</title>
		<link>http://www.zachleat.com/web/enlarging-your-yui-datatable-in-29-seconds-or-less/</link>
		<comments>http://www.zachleat.com/web/enlarging-your-yui-datatable-in-29-seconds-or-less/#comments</comments>
		<pubDate>Wed, 29 Aug 2007 03:09:48 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[DataTable]]></category>
		<category><![CDATA[Expandable]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/08/28/enlarging-your-yui-datatable-in-29-seconds-or-less/</guid>
		<description><![CDATA[This is an updated version of the Enlarging your YUI DataTable in 30 Seconds or Less! modified for the newly released YUI 2.3.0. This method adds an extra row to the YUI DataTable when a row is selected, below the selected row. This allows the developer to add additional content that might not be applicable [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is an updated version of the <a href="http://www.zachleat.com/web/2007/06/07/enlarging-your-yui-datatable-in-30-seconds-or-less/">Enlarging your YUI DataTable in 30 Seconds or Less!</a> modified for the newly released YUI 2.3.0.</em></p>
<p>This method adds an extra row to the YUI DataTable when a row is selected, below the selected row.  This allows the developer to add additional content that might not be applicable to the column constraints of a typical datatable or grid and allow that content be displayed more fluidly inside a single row spanning all of the viewable columns.</p>
<p>I know you&#8217;re anxious for an example, so let&#8217;s see some screenshots of a simple YUI DataTable:</p>
<p><a href="http://www.zachleat.com/Lib/ymod/ymod-tableExtension-2.3.0.html"><img src='http://www.zachleat.com/web/wp-content/uploads/2007/08/default-datatable.gif' alt='Default DataTable' /></a></p>
<p>Turns into this when a row is selected:</p>
<p><a href="http://www.zachleat.com/Lib/ymod/ymod-tableExtension-2.3.0.html"><img src='http://www.zachleat.com/web/wp-content/uploads/2007/08/datatable-selected.gif' alt='Row selected' /></a></p>
<p>Click any of the above images for a live example.</p>
<p>Any HTML can be added.  You can make an AJAX call and put the result into the newly inserted row (that will be left as an exercise for the reader [you]).</p>
<p>I know you&#8217;re asking yourself, how the hell do I add this to my YUI DataTable?  WHERE IS THE DAMN SOURCE CODE?  Calm down, you know I&#8217;m getting to it.</p>
<h3>How To</h3>
<p>1. Include the <a href="http://www.zachleat.com/Lib/ymod/ymod-tableExtension-2.3.0.js">ymod-tableExtension-2.3.0.js</a> file.<br />
2. Create your DataTable.  If you don&#8217;t know how to do this, go to the <a href="http://developer.yahoo.com/yui/datatable/">official documentation for help and examples</a>.<br />
3. Make sure your DataTable has the selectionMode parameter set to &#8216;single&#8217;.  This can be achieved by passing in <code>{ selectionMode: 'single' }</code> in as the 4th argument to the DataTable constructor.<br />
4. Use the following code to setup your table extension:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// myDataTable is your DataTable object</span>
YAHOO.<span style="color: #660066;">ymod</span>.<span style="color: #660066;">tableExtension</span>.<span style="color: #660066;">setup</span><span style="color: #009900;">&#40;</span> myDataTable<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> contentDiv <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> myContent <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> selectedRows <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getSelectedRows</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> selectedRows.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        myContent <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'Do something based on&lt;br /&gt;the row that is selected!'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    contentDiv.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> myContent<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The setup function is basically a convenience method to add the event listeners.  You can just as easily do this yourself manually:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// myDataTable is your DataTable object.</span>
myDataTable.<span style="color: #660066;">subscribe</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'headerRowMousedownEvent'</span><span style="color: #339933;">,</span> YAHOO.<span style="color: #660066;">ymod</span>.<span style="color: #660066;">tableExtension</span>.<span style="color: #660066;">cleanUp</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
myDataTable.<span style="color: #660066;">subscribe</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'rowClickEvent'</span><span style="color: #339933;">,</span> YAHOO.<span style="color: #660066;">ymod</span>.<span style="color: #660066;">tableExtension</span>.<span style="color: #660066;">selectRow</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> contentDiv <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009966; font-style: italic;">/* same as function appears above */</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>CSS</h3>
<p>Here&#8217;s some CSS hooks to do some styling.  The expanded row will include the yui-dt-selected class by default.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/* The original table row clicked on */</span>
tr.<span style="color: #660066;">ymod</span><span style="color: #339933;">-</span>expanded <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009966; font-style: italic;">/* Row containing the expanded content */</span>
tr.<span style="color: #660066;">ymod</span><span style="color: #339933;">-</span>expandedData <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
<span style="color: #009966; font-style: italic;">/* Div containing the expanded content inside the row */</span>
tr.<span style="color: #660066;">ymod</span><span style="color: #339933;">-</span>expandedData div.<span style="color: #660066;">ymod</span><span style="color: #339933;">-</span>expandedDataContent <span style="color: #009900;">&#123;</span> background<span style="color: #339933;">-</span>color<span style="color: #339933;">:</span> navy<span style="color: #339933;">;</span> padding<span style="color: #339933;">:</span> 2px 6px<span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></div></div>

<h3>Limitations</h3>
<p> &#8211; Resorting removes the expanded content.  Otherwise it was messing with the sort.<br />
 &#8211; It only works with single row selection mode, which allows only one row to be selected at a time.  This is not the default (standard), which allows multiple rows to be selected with SHIFT or CTRL.  Feel free to modify this to work with other modes!</p>
<h1><a href="http://www.zachleat.com/Lib/ymod/ymod-tableExtension-2.3.0.js">Download ymod-tableExtension-2.3.0.js</a></h1>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/enlarging-your-yui-datatable-in-29-seconds-or-less/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Enlarging your YUI DataTable in 30 Seconds or Less!</title>
		<link>http://www.zachleat.com/web/enlarging-your-yui-datatable-in-30-seconds-or-less/</link>
		<comments>http://www.zachleat.com/web/enlarging-your-yui-datatable-in-30-seconds-or-less/#comments</comments>
		<pubDate>Fri, 08 Jun 2007 02:51:08 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Interface Design]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Expandable]]></category>
		<category><![CDATA[Grid]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/06/07/enlarging-your-yui-datatable-in-30-seconds-or-less/</guid>
		<description><![CDATA[Please note that this post has been updated to the new version of YUI, 2.3.0 in an article called &#8220;Enlarging your YUI DataTable in 29 Seconds or Less!&#8221; Do you want to fit more content onto your DataTable, but don&#8217;t know how? Do you wish that you had fewer columns, or more horizontal screen-estate? Well [...]]]></description>
			<content:encoded><![CDATA[<p><b>Please note that this post has been updated to the new version of YUI, 2.3.0 in an article called <a href="http://www.zachleat.com/web/2007/08/28/enlarging-your-yui-datatable-in-29-seconds-or-less/">&#8220;Enlarging your YUI DataTable in 29 Seconds or Less!&#8221;</a></b></p>
<p>Do you want to fit more content onto your DataTable, but don&#8217;t know how?  Do you wish that you had fewer columns, or more horizontal screen-estate?  Well now you can enlarge your table easily with these simple functions!  Instead of adding more information into additional columns, we have used our patented method of not actually patenting anything to bring you a secret formula that will allow you to dynamically insert rows into your table, designed for holding additional, non-constrained customizable content!</p>
<p>Do you mean to tell me that your formula will give that special lady in your life the DataTable that she has always wanted?</p>
<p>Of course!  In fact, we guarantee this DataTable to satisfy all of the women you know and don&#8217;t know in the world or we&#8217;ll give you a full refund of the purchase price!</p>
<p>Wow! How does it work?</p>
<p><a href="http://www.zachleat.com/Projects/valdi/__test_yui_datatable_expandable.html"></p>
<p>Click here for an example!</p>
<p><img src='http://www.zachleat.com/web/wp-content/uploads/2007/06/datatable.gif' alt='Normal DataTable' /></p>
<p><img src='http://www.zachleat.com/web/wp-content/uploads/2007/06/datatableexpanded.gif' alt='Expanded DataTable' /><br />
</a></p>
<p>When you click on a row in the DataTable, it inserts a child row beneath the row with an HTML string passed in to populate the dynamic content.  When you click on the parent row or the new row that was inserted, the content disappears!  It&#8217;s that easy!  You don&#8217;t have to apply any gross awful smelling creams, or take any large horse-sized pills for this to work!  You literally only use the following code to do it:</p>
<p>Usage Code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> myDataTable <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> YAHOO.<span style="color: #660066;">widget</span>.<span style="color: #660066;">DataTable</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;myContainer&quot;</span><span style="color: #339933;">,</span>myColumnSet<span style="color: #339933;">,</span>myDataSource<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
myDataTable.<span style="color: #660066;">subscribe</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;cellClickEvent&quot;</span><span style="color: #339933;">,</span> myDataTable.<span style="color: #660066;">onEventSelectRow</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// make sure you're firing the row selection event</span>
myDataTable.<span style="color: #660066;">subscribe</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;cellClickEvent&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> e <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #003366; font-weight: bold;">var</span> myCustomHtml <span style="color: #339933;">=</span> <span style="color: #3366CC;">'Hello, this is my expanded content.&lt;br /&gt;:-)&lt;br /&gt;'</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// generate the string, could use an ajax call if you wanted.</span>
   YAHOO.<span style="color: #660066;">ymod</span>.<span style="color: #660066;">datatable</span>.<span style="color: #660066;">clickAndExpand</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">,</span> e<span style="color: #339933;">,</span> myCustomHtml <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// if you do use an ajax call, this function returns a reference to the newly created div that you can put the ajax results into.</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Library Code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">YAHOO.<span style="color: #003366; font-weight: bold;">namespace</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'YAHOO.ymod.datatable'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
YAHOO.<span style="color: #660066;">ymod</span>.<span style="color: #660066;">datatable</span>.<span style="color: #660066;">clickAndExpand</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> e<span style="color: #339933;">,</span> expandedHtml <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> selectedRows <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getSelectedRows</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> selectedRows.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">hasClass</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'ymod-expandedData'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span>.<span style="color: #660066;">previousSibling</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'expanded'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span>.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">hasClass</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'ymod-expanded'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #003366; font-weight: bold;">var</span> newRow <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'tr'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003366; font-weight: bold;">var</span> newCell <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'td'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #003366; font-weight: bold;">var</span> newDiv <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'div'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span> newDiv<span style="color: #339933;">,</span> <span style="color: #3366CC;">'ymod-expandedDataContent'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> expandedHtml <span style="color: #339933;">!=</span> <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> newDiv.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> expandedHtml<span style="color: #339933;">;</span>
			newCell.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span> newDiv <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			newCell.<span style="color: #660066;">colSpan</span> <span style="color: #339933;">=</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span>.<span style="color: #660066;">childNodes</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
			newRow.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span> newCell <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>		
			YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span> newRow<span style="color: #339933;">,</span> <span style="color: #3366CC;">'ymod-expandedData'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">hasClass</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'yui-dt-odd'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span> newRow<span style="color: #339933;">,</span> <span style="color: #3366CC;">'yui-dt-odd'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">hasClass</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'yui-dt-even'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span> newRow<span style="color: #339933;">,</span> <span style="color: #3366CC;">'yui-dt-even'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'ymod-expanded'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span>.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">insertBefore</span><span style="color: #009900;">&#40;</span> newRow<span style="color: #339933;">,</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span>.<span style="color: #660066;">nextSibling</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Event</span>.<span style="color: #660066;">addListener</span><span style="color: #009900;">&#40;</span> newRow<span style="color: #339933;">,</span> <span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> e <span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				YAHOO.<span style="color: #660066;">ymod</span>.<span style="color: #660066;">datatable</span>.<span style="color: #660066;">collapseRow</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">this</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Event</span>.<span style="color: #660066;">stopEvent</span><span style="color: #009900;">&#40;</span> e <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'yui-dt-selected'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Event</span>.<span style="color: #660066;">stopEvent</span><span style="color: #009900;">&#40;</span> e <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">return</span> newDiv<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
			selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span>.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span>.<span style="color: #660066;">nextSibling</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'ymod-expanded'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span> selectedRows<span style="color: #009900;">&#91;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'yui-dt-selected'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Event</span>.<span style="color: #660066;">stopEvent</span><span style="color: #009900;">&#40;</span> e <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// pass in the expanded content, NOT the parent row.</span>
YAHOO.<span style="color: #660066;">ymod</span>.<span style="color: #660066;">datatable</span>.<span style="color: #660066;">collapseRow</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> row <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span> row.<span style="color: #660066;">previousSibling</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'ymod-expanded'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	YAHOO.<span style="color: #660066;">util</span>.<span style="color: #660066;">Dom</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span> row.<span style="color: #660066;">previousSibling</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'yui-dt-selected'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	row.<span style="color: #660066;">parentNode</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span> row <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Customize the CSS, if desired.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.yui-dt-table</span> tr<span style="color: #6666ff;">.ymod-expandedData</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#bdcede</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">pointer</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.yui-dt-table</span> tr<span style="color: #6666ff;">.ymod-expandedData</span> td <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">padding-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">visible</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.yui-dt-table</span> tr.ymod-<span style="color: #993333;">expanded</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#bdcede</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.yui-dt-table</span> tr.ymod-<span style="color: #993333;">expanded</span> td <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.yui-dt-table</span> div<span style="color: #6666ff;">.ymod-expandedDataContent</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f4f4f4</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">inset</span> <span style="color: #cc00cc;">#aaa</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">white-space</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span> zoom<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">overflow</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>You might even want to put a little + and &#8211; into the first column of each row to give a visual cue that there is more information for display available on click.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/enlarging-your-yui-datatable-in-30-seconds-or-less/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

