<?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>YUI Coder &#187; YUI Datatable</title>
	<atom:link href="http://www.yuicoder.com/category/yahoo_user_interface_datatable/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yuicoder.com</link>
	<description>Manipulating the Yahoo User Interface to your will!</description>
	<lastBuildDate>Mon, 16 Aug 2010 22:52:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>YUI DataTable: Context Menu with &#8220;Select/Unselect All&#8221; rows</title>
		<link>http://www.yuicoder.com/2009/11/yui-datatable-context-menu-with-selectunselect-all-rows/</link>
		<comments>http://www.yuicoder.com/2009/11/yui-datatable-context-menu-with-selectunselect-all-rows/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 12:26:06 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Datatable]]></category>
		<category><![CDATA[YUI Mish Mash]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=171</guid>
		<description><![CDATA[Andy from Coderfoo.com created this excellent example and code sniplet to demo a function he created that uses a context menu to select and deselect all rows from a YUI datatable. At first I simply thought he was just accessing a regular function within YUI but he soon corrected me. He explained that while YUI [...]]]></description>
			<content:encoded><![CDATA[<p>Andy from <a href="http://www.coderfoo.com">Coderfoo.com</a> created this excellent example and code sniplet to demo a function he created that uses a context menu to select and deselect all rows from a YUI datatable. At first I simply thought he was just accessing a regular function within YUI but he soon corrected me. He explained that while YUI has a deselect function for all rows a select all function did not exist. So knowing Andy he took on the challenge of creating this function. Thanks again Andy for sharing your code with us.<br />
Working Example on <a href="http://www.coderfoo.com">CoderFoo.com</a> <a href="http://www.coderfoo.com/examples/datatable-multi-row-select.html">http://www.coderfoo.com/examples/datatable-multi-row-select.html</a></p>
<h2>Get the code</h2>
<pre>
<textarea name="code" class="JavaScript" cols="60" rows="10">
YAHOO.lang.augmentObject(
  YAHOO.widget.DataTable.prototype, {
    _selectAllTrEls : function() {
      var selectedRowsEven = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_EVEN, "tr",this._elTbody);
      YAHOO.util.Dom.addClass( selectedRowsEven , YAHOO.widget.DataTable.CLASS_SELECTED);
      var selectedRowsOdd = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_ODD, "tr",this._elTbody);
      YAHOO.util.Dom.addClass( selectedRowsOdd, YAHOO.widget.DataTable.CLASS_SELECTED);
    },
  /* Selects all rows. * * @method selectAllRows */
  selectAllRows : function() {
    // Remove all rows from tracker
    var tracker = this._aSelections || [];
    for(var j=tracker.length- 1; j>-1; j--) {
      if(YAHOO.lang.isString( tracker[j] )){
        tracker.splice( j,1);
      }
    }
    // Update tracker
    this._aSelections = tracker;
    // Update UI
    this._selectAllTrEls();
    // Get all highlighted rows and make yahoo aware they are selected
    var selectedRowsEven = YAHOO.util.Dom.getElementsByClassName(YAHOO.widget.DataTable.CLASS_SELECTED, "tr",this._elTbody);
    for (i=0;i
<selectedRowsEven.length; i++){
      this.selectRow(i);
    }
  }
});
</textarea>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2009/11/yui-datatable-context-menu-with-selectunselect-all-rows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding up column data in the YUI Datatable</title>
		<link>http://www.yuicoder.com/2009/03/adding-up-column-data-in-the-yui-datatable/</link>
		<comments>http://www.yuicoder.com/2009/03/adding-up-column-data-in-the-yui-datatable/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 15:45:59 +0000</pubDate>
		<dc:creator>Jeffrey Cobb</dc:creator>
				<category><![CDATA[YUI Datatable]]></category>

		<guid isPermaLink="false">http://www.yuicoder.com/?p=74</guid>
		<description><![CDATA[At times it becomes necessary to add up the data with in a column. Here is a nice little snippet that can do just that. Change DATATABLE with the name of the data table you need to read. Change COLUMNNAME with the column key in the table you need to read. // First get the [...]]]></description>
			<content:encoded><![CDATA[<p>At times it becomes necessary to add up the data with in a column. Here is a nice little snippet that can do just that.<br />
Change <em>DATATABLE</em> with the name of the data table you need to read.<br />
Change <em>COLUMNNAME</em> with the column key in the table you need to read.</p>
<pre name="code" class="JavaScript">
// First get the record set from the datatable.
var records = DATATABLE.getRecordSet();

// Let's count how many records we found
var len = records._records.length-1;
var total = 0;
// Loop through the record set getting the data from the coulumn and setting its value to "value"

for(i=0;i<=len;i++){
 //create the value you need so you can handle the data
var value = records._records[i]._oData.COLUMNNAME;
// now all you need to do is add up your values
total+=value;
}
//log it to the FireBug console
console.log(total);
</pre>
<p>Once you have found the value for the column from that point you can manipulate the data to your will.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yuicoder.com/2009/03/adding-up-column-data-in-the-yui-datatable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

