The Gallery is deprecated. No new Gallery components may be submitted, and modifying existing components is disabled. For more information please read the Gallery Deprecation blog post. This is a static snapshot of the Gallery for archive purposes.
See 14 more by this user. Created: 11/25/09
Project: YUI 3
License: YUI BSD
YUI Version: 3.2.0
Free for use.
The DataFinder class is a utility that works with a Y.DataSource instance to generate query strings, keep track of previously set query parameters, and turn a list of results into a RecordSet. The Record and RecordSet classes are currently almost direct ports of those classes in the YUI 2 DataTable widget.
DataFinder is fairly simple to use, you start by creating a DataSource instance and configuring that with your DataSchema. You then instantiate a DataFinder and attach the DataSource, subscribe to the success and failure events, set any number of query parameters, and execute a fetch.
YUI().use('gallery-datafinder', function(Y) {
var ds = new Y.DataSource.IO({
source : 'test.php?action=testFn'
});
ds.plug({fn : Y.Plugin.DataSourceJSONSchema, cfg : {
schema : {
resultListLocator : "results.list",
resultFields : [
"name",
"email"
]
}
}});
var df = new Y.DataFinder({
dataSource : ds
});
df.after('success', function (args) {
if (args.records) {
var myRecordSet = args.records;
// use RecordSet
}
});
df.after('failure', function (args) {
// Handle the IO failure
});
df.setParam('foo', 'bar');
df.fetch();
});
No forum posts for this module.
All code on this site is licensed under the BSD License unless stated otherwise.