Skip to content

Instantly share code, notes, and snippets.

@stlsmiths
Created January 5, 2012 21:21
Show Gist options
  • Save stlsmiths/1567371 to your computer and use it in GitHub Desktop.
Save stlsmiths/1567371 to your computer and use it in GitHub Desktop.
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>
<script src="bench_data500.js"></script>
<script type="text/javascript">
var loader = new YAHOO.util.YUILoader({
require: [ 'reset-fonts', 'base', 'yuiloader-dom-event', "datatable", "datasource", "logger" ],
loadOptional: true,
timeout: 1000,
combine: true,
// The function to call when all script/css resources have been loaded
onSuccess: function() {
//
// Aliases for YUI placeholders
//
var YDom = YAHOO.util.Dom,
YUtil = YAHOO.util,
YEvent = YAHOO.util.Event,
YLang = YAHOO.lang,
YConnect = YUtil.Connect;
YAHOO.util.Event.onDOMReady( function() {
var myLR = new YAHOO.widget.LogReader("",{footerEnabled:false});
myLR.hideCategory("warn");
myLR.hideCategory("info");
myLR.hideCategory("warn");
myLR.hideCategory("time");
myLR.hideCategory("window");
myLR.showCategory("MYDT");
var myDS = new YUtil.LocalDataSource( jsArray );
myDS.responseType = YUtil.DataSource.TYPE_JSARRAY;
myDS.responseSchema = {
fields:['pkey', 'pint', 'ptxt', 'pdbl', 'pdt' ]
};
var cols = [
{ key: "pkey", label: "*pkey" },
{ key: "pint", label: "Random Int" },
{ key: "ptxt", label: "Random Text" },
{ key: "pdbl", label: "Random Float" },
{ key: "pdt", label: "Random Date/Time" }
];
YAHOO.log("Prior to instantiation", "myDT");
var myDT = new YAHOO.widget.DataTable( 'divHere', cols, myDS );
YAHOO.log(" ... done instantiating", "myDT");
myDT.on("postRenderEvent",function(o) {
YAHOO.log(" ... done rendering", "myDT"); // not sure if this is best way to get "after Render" ...
});
}); // end onDOMREady
}
});
loader.insert();
</script>
<h2>YUI 2 DT Benchmarking - 2.9.0</h2>
<div id="divHere"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment