Skip to content

Instantly share code, notes, and snippets.

View stlsmiths's full-sized avatar
🎯
Focusing

Todd Smith stlsmiths

🎯
Focusing
View GitHub Profile
@stlsmiths
stlsmiths / YUI3_resize.html
Created August 24, 2011 17:37
YUI3 Resize with start event
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Resize Example</title>
<style type="text/css">
#demo {
height: 100px;
width: 100px;
// Define a custom formatter to format Numbers as US currency format, and if negative, to
// set color to RED and surround with parenthesis;
// Example: ( $ 12,345.67 ) in red
// Note: Function needs to be defined BEFORE the Column definitions that use it !!
var fmtNegCurrency = function(elCell, oRec, oCol, oData) {
var num_prefix='',
num_suffix='';
if ( oData < 0.0 ) {
YAHOO.util.Dom.setStyle(elCell,'color','red');
@stlsmiths
stlsmiths / README.markdown
Created January 4, 2012 23:48
YUI 3.5.0PR1 new DataTable benchmarking - 500 records

Initial Benchmarking of YUI 2 vs YUI 3 DataTables

This was a basic "brute force" testing for basic timings, using the YUI Console tool -- definitely not a comprehensive study (i.e. no profiling, etc..).

The basic test consists of creating and rendering a simple DT (no parsing, formatting, sorting, scrolling, editing, etc...) using a local Javascript Array for the data with 500 records. Yes, I know 500 records is quite a lot of data without using other features (pagination, scrolling), but I wanted something to allow enough time and enough page elements to make it somewhat interesting!

CASE 1 : The YUI 2.9 DT example dt_290_array500.html and source at gist 1567371

CASE 2 : The YUI 3.4.1 DT example dt_341_array500.html and source at gist 1567375

@stlsmiths
stlsmiths / dt_290_array500.html
Created January 5, 2012 21:21
YUI 2.9.0 DT bench example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI 2 - DT Benchmarking 2.9.0</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body class="yui-skin-sam">
<script src="http://yui.yahooapis.com/2.9.0/build/yuiloader/yuiloader-min.js"></script>
@stlsmiths
stlsmiths / dt_341_array500.html
Created January 5, 2012 21:22
YUI 3.4.1 DT bench example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI 3 - DT Benchmarking 3.4.1</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/cssfonts/fonts-min.css" />
<!-- <link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/datatable-base/assets/datatable-base-core.css" />
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/datatable-base/assets/skins/sam//datatable-base-skin.css" />
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/datatable-base/assets/skins/sam//datatable-base-skin.css" />
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/datatable-base/assets/skins/sam//datatable-base.css" />
@stlsmiths
stlsmiths / dt_350pr1_array500.html
Created January 5, 2012 21:23
YUI 3.5.0PR1 DT bench example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI 3 - DT Benchmarking 3.5.0PR1</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/cssfonts/fonts-min.css" />
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/datatable-base/assets/datatable-base-core.css" />
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/datatable-base/assets/skins/sam//datatable-base-skin.css" />
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/datatable-base/assets/skins/sam//datatable-base-skin.css" />
<link type="text/css" rel="stylesheet" href="http://yui.yahooapis.com/3.4.1/build/datatable-base/assets/skins/sam//datatable-base.css" />
<div id="myChart" style="width:400px;height:400px;"></div>
<script type="text/javascript">
YUI.use('charts', function(Y) {
var myData = [
{category: 'Monday', values: 2},
{category: 'Tuesday', values: 5},
{category: 'Wednesday', values: 7},
{category: 'Thursday', values: 6},
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>YUI 3 </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- Any Custom CSS goes here -->
</head>
//
// Custom Parser for SQL formatted date strings ...
//
// Following taken directly from Satyam's YUIBlog article:
// http://yuiblog.com/blog/2008/10/15/datatable-260-part-one/
//
// This is used in the formatter below, to first convert the data to a JS Date, then format it !!!
var parseSQLDate = function (o) {
var parts = o.split(' ');
datePart = parts[0].split('-');
@stlsmiths
stlsmiths / datatable.js
Created February 6, 2012 17:42 — forked from dhoss/datatable.js
stlsmith's edits
[% page.load_scripts_at_top = 1 %]
<!-- IF you add this, you will run the 3.5.0pr2 code directly from yuilibrary, and can remove all your Gallery crap ...
<script type="text/javascript" src="http://yui.yahooapis.com/3.5.0pr2/build/yui/yui-min.js"></script>
-->
<script type="text/javascript">
/* Delete the gallery stuff