Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lsmith/150431 to your computer and use it in GitHub Desktop.
Save lsmith/150431 to your computer and use it in GitHub Desktop.
YAHOO.util.Event.onDOMReady(function () {
var Ex = YAHOO.namespace('example');
YAHOO.util.Connect.asyncRequest('GET','data.php',{
success : function (o) {
var data = YAHOO.lang.JSON.parse(o.responseText);
function dataMarshaller(section) {
return data.records[section] || [];
}
Ex.dataSource = new YAHOO.util.DataSource(dataMarshaller, {
responseType : YAHOO.util.DataSource.TYPE_JSARRAY,
responseSchema : {
fields : ['foo','bar','baz']
}
});
Ex.columns = [ { key: 'foo' }, { key: 'bar' }, { key: 'baz' } ];
Ex.dataTable = new YAHOO.widget.DataTable('tbl1', Ex.columns,
Ex.dataSource, { initialRequest : 'todo' });
Ex.dataTable = new YAHOO.widget.DataTable('tbl2', Ex.columns,
Ex.dataSource, { initialRequest : 'doing' });
Ex.dataTable = new YAHOO.widget.DataTable('tbl3', Ex.columns,
Ex.dataSource, { initialRequest : 'done' });
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment