Skip to content

Instantly share code, notes, and snippets.

View stlsmiths's full-sized avatar
🎯
Focusing

Todd Smith stlsmiths

🎯
Focusing
View GitHub Profile
<html>
<head>
<title>YUI DataTable Exercises</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
/* define your styles here */
</style>
</head>
// Class extension to DataTable ...
Y.DataTableAdded = Y.Base.create( 'datatable-added', Y.DataTable, [], {
initializer : function() {
this.delegate( "click", _defTRClickHandler, "tr" );
this.delegate( "click", _defTDClickHandler, "td" ); // need selector work here ...
this.delegate( "click", _defTHClickHandler, "th" );
@stlsmiths
stlsmiths / gist:2569489
Created May 1, 2012 16:38
yui2.9_loader.html
<html>
<head>
<title>YUI Loader Usage</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<style type="text/css">
/* define custom styles here */
</style>
</head>
.yui3-skin-sam .yui3-datatable tr.myhilite td { background-color: #C0ffc0; }
var dt = new Y.DataTable({....});
dt.delegate("click",function(e){
var tr = e.target;
YUI().use( "datatable-scroll", "datatable-message", "datatable-datasource", "datasource-io", "datasource-xmlschema", function (Y) {
//
// Define the DataSource, can't use DataSource.Get with XML (only supports JSON),
// so define an IO DS and plugin the Schema
//
var myDS = new Y.DataSource.IO({ source: '../srvDataGET.php?iact=xml' });
myDS.plug(Y.Plugin.DataSourceXMLSchema, {
schema: {
@stlsmiths
stlsmiths / gist:3305298
Created August 9, 2012 15:46
one-off extension of DataTableDataSource plugin ...
// Need to create a one-time extension of DataTableDataSource Plugin,
DTDSAddPag = Y.Base.create('datasourcepag', Y.Plugin.DataTableDataSource, [], {
// Need to override this base method ...
onDataReturnInitializeTable: function(e) {
var records = (e.response && e.response.results) || [];
// Add this to update the DS state
@stlsmiths
stlsmiths / gist:3362874
Created August 15, 2012 19:31
DT Paginator - remote pagination concepts
/*
We need to somehow build in mapping between the Paginator.Model ATTRS and
remote server request for both "outgoing" and "response" data.
I was thinking of a "server hash" in some manner, that could handle the
translation for known Paginator.Model attributes to both url/querystring
placeholders for outgoing request, and to handle returned data in the
incoming response back from the server (... that need to be loaded back
into the Paginator.Model [think totalRecords])
@stlsmiths
stlsmiths / gist:3494655
Created August 28, 2012 03:20
Datatable paginator.view using ModelSync.REST
YUI({
filter:'raw', combine:false,
// paginator-view is on YUI Gallery
modules: {
'datatable-paginator': {
fullpath: "http://www.jbistudios.com/applicationdev/js/yui/build/datatable-paginator-class/datatable-paginator-class.js",
type: 'js',
requires: [ "datatable-base", "base-build", "event-custom" ]
}
@stlsmiths
stlsmiths / gist:3494809
Created August 28, 2012 03:53
Datatable paginator.view using ModelSync.REST
YUI({
filter:'raw', combine:false,
modules: {
'datatable-paginator': {
fullpath: "http://www.jbistudios.com/applicationdev/js/yui/build/datatable-paginator-class/datatable-paginator-class.js",
type: 'js',
requires: [ "datatable-base", "base-build", "event-custom" ]
},
'paginator-css' : {
fullpath: "http://jbistudios.com/applicationdev/js/yui/build/paginator-mv/assets/paginator-view.css",
YUI({
// use PaginatorView and DataTable-Paginator from the YUI Gallery
gallery: 'gallery-2012.08.29-20-10'
}).use( 'datatable-sort', ..... blah, blah, blah, blah ...
'model-sync-rest',
'gallery-datatable-paginator', 'gallery-paginator-view',
function(Y) {