Adrian Lanning![]()
Fix for Bug Ticket #2529808
http://yuilibrary.com/projects/yui3/ticket/2529808
The 3.3.0 datatable-scroll plugin assumes that the datatable's underlying recordset will already be populated with data and will throw an error if it is empty. This patch wraps the offending function to check for the empty case and also registers an 'after' event handler to re-sync the UI whenever the underlying recordset is changed.
Thanks to eamonb (a.k.a mosen) for his peer review and help testing.
Thanks to rgrove for defining the naming convention for user patches.
*** For anyone else interested in submitting user patches ***
User patch naming convention: "gallery-user-patch-<version #>-<ticket #>" <-- use this naming convention
Only Yahoo! employees can use the official patch naming convention: "gallery-patch-330-toggleview"
Allows loading of table data from external source after scrollable datatable has been rendered.
Github src/test directory contains a complete example:
https://github.com/alanning/yui3-gallery/blob/master/src/gallery-user-patch-2529808/test/test-patch-2529808.html
<script src="http://yui.yahooapis.com/3.3.0/build/yui/yui-min.js"></script>YUI({
filter:"debug",
gallery: 'gallery-2011.05.18-19-11'
}).use('datasource', 'datatable', 'gallery-user-patch-2529808', function(Y) {
var myDataSource = new Y.DataSource.Get({
source:"http://query.yahooapis.com/v1/public/yql?format=json&"});
myDataSource.plug(Y.Plugin.DataSourceJSONSchema, {
schema: {
resultListLocator: "query.results.place",
resultFields: ["name","woeid"]
}
});
var columnSet2 = [ "name", "woeid" ];
// render datatable before load
var dataTable2 = new Y.DataTable.Base({
caption:"DataTable with DataSource and Scroll plugins",
columnset:columnSet2
})
.plug(Y.Plugin.DataTableScroll, {height: "200px"})
.plug(Y.Plugin.DataTableDataSource, {datasource:myDataSource})
.render("#datatable2")
;
// now load data
dataTable2.datasource.load(
{
request:"q=select%20*%20from%20geo.counties%20where%20place%3D%22TN%22"
});
});
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info