2in3_datatable.html revision b39897a381c2203466da5568bfd2862a54a81311
<html debug="true">
<head>
body {
margin:0;
padding:0;
}
#container { position: relative; padding: 6px; background-color: #eeeeee; width: 420px; height:220px; }
/* custom styles for this example */
.yui-skin-sam .yui-dt-liner { white-space:nowrap; }
</style>
<title>use('yui2-datatable') and then get dependencies</title>
<!--
<script type="text/javascript" src="/yui2-docs/templates/examples/datatable/assets/js/data.js"></script>
-->
YUI({
combine: true, // running locally, so I need to force combo handling
yui2: '2.8.1',
'2in3': '4',
groups: {
yui2: {
patterns: {
'yui2-': {
configFn: function(me) {
me.type = 'css';
me.path = me.path.replace(/\.js/, '.css');
}
}
}
}
}
},
modules: {
// this file creates 'YAHOO.example.Data' when loaded, so it can't be used inline
// or dyamically loaded until a YAHOO global has been created (which we don't
// do by default
data: {
requires: ['yui2-yahoo']
},
// YUI3 module
'example-data': {
fullpath: 'data.js'
}
}
// gallery: 'gallery-2010.02.22-22'
}).use('yui2-dragdrop', 'yui2-datatable', 'example-data', 'base', 'gallery-yql', function (Y) {
// Need to break out of the sandbox if we are going to allow modules
// to add to the global YAHOO directly. It is better when you don't need
// to do this.
// YAHOO = Y.YUI2;
var YAHOO = Y.YUI2;
// Modules that access the global directly should be loaded
// after the YUI2 environment is set up.
// Y.use('data', function() {
// The window load event has fired
// YAHOO.util.Event.addListener(window, "load", function() {
YAHOO.util.Event.onAvailable("basic", function() {
YAHOO.example.Basic = function() {
var myColumnDefs = [
{key:"id", sortable:true, resizeable:true},
{key:"date", formatter:YAHOO.widget.DataTable.formatDate, sortable:true, sortOptions:{defaultDir:YAHOO.widget.DataTable.CLASS_DESC},resizeable:true},
{key:"quantity", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true, resizeable:true},
{key:"amount", formatter:YAHOO.widget.DataTable.formatCurrency, sortable:true, resizeable:true},
{key:"title", sortable:true, resizeable:true}
];
var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.bookorders);
fields: ["id","date","quantity","amount","title"]
};
var myDataTable = new YAHOO.widget.DataTable("basic",
myColumnDefs, myDataSource, {caption:"DataTable Caption"});
return {
oDS: myDataSource,
oDT: myDataTable
};
}();
});
// });
});
</script>
</head>
<body class="yui-skin-sam">
<div id="basic"></div>
</body>
</html>