Created
July 20, 2009 16:33
-
-
Save lsmith/150431 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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