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 / gist:3940973
Created October 23, 2012 19:16
DS pag with custom query
// YUI3 functionality
YUI({skin: 'night'}).use('autocomplete', 'autocomplete-filters', 'autocomplete-highlighters', 'datatable-sort', 'datatable-scroll', 'cssfonts', 'cssbutton', 'dataschema-json', 'datatable-datasource', 'datasource-io', 'datatype', "datasource-jsonschema", 'model-sync-rest', 'gallery-paginator-view', 'gallery-datatable-paginator', 'dataschema', function(Y){
// Create datasource
var ds = new Y.DataSource.IO({source: '/index/test/load'});
ds.plug(Y.Plugin.DataSourceJSONSchema, {
schema: {
resultListLocator: 'Results',
resultFields: ['id', 'name'],
metaFields: {
@stlsmiths
stlsmiths / main.js
Created October 12, 2012 14:17 — forked from davglass/main.js
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Your Title</title>
<!-- Enter any page specific CSS link files -->
<link href="/yui/google-code-prettify/prettify.css" rel="stylesheet" type="text/css" />
<!-- Enter any local CSS declarations here -->
<style></style>
Y.MyAwesomeView = Y.Base.create('myview',Y.View,[],{
// static props and methods
},{
// attrs and stuff
});
// referring to http://yuilibrary.com/yui/docs/api/classes/Base.html#method_create
//
@stlsmiths
stlsmiths / dt_formatters.js
Created August 31, 2012 17:03
DT formatters
//
// trying to implement "named" formatters ... as {key:'foo', formatter:"currency2", ...}
//
// getting close ... http://blunderalong.com/yui/dtb/dt_formatters1.html
//
YUI.add("dt-formatters", function(Y){
var DtFormatStrings = {
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) {
@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",
@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: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: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
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: {