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/8/11
Project: YUI 3
License: YUI BSD
YUI Version: 3.4.1
Free for use.
This plugin allows you to present groups of rows under a single heading, keyed by a given attribute of the records contained within.
By adding the plugin to any DataTable instance and specifying the key to group by, the table will automatically render in groups. The value for "groupBy" can also be a function which will receive a copy of each record in the table and should return a string key to group by. Additionally, a "groupLabelRenderer" can be specified to apply custom formatting to the groups.
YUI().use('gallery-grouped-table', 'datasource-local', function(Y) {
var table = new Y.DataTable({
columnset : [{key : 'firstName'}, {key : 'lastName'}, {key : 'workplace'}],
plugins : [
{fn : Y.Plugin.GroupedDataTable, cfg : {
groupBy : 'workplace'
}}
]
});
// Add data to table ...
table.render(); // Rows will be in groups by "workplace"
});
All code on this site is licensed under the BSD License unless stated otherwise.