• Register
  • Log In
  • Home
  • Quick Start
    • Configurator
    • Download YUI 3
  • Documentation
    • User Guides
    • Examples
    • API Docs
    • Environments
    • Tutorials
  • Community
    • Gallery
    • Blog
    • Forums
    • YUI Theater
    • Calendar
  • Contribute
    • YUI on GitHub »
    • File a Ticket
    • View Tickets
    • Dashboard
  • Other Projects
    • Shifter »
    • Yogi »
    • YUI 2
    • YUI Doc »
    • YUI Test
    • YUI Website
    • YUI Compressor »
    • YUI Builder »
    • YUI PHP Loader
    • Grid Builder »
    • Skin Builder »
  • YUI
  • >
  • Community
  • >
  • Gallery

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • Yogi Documentation
  • Shifter Documentation
  • Developer Guide
  • Module Setup

Tag Cloud

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    Grouped DataTable (gallery-grouped-table)

    Last Updated: 11/8/11
    + 1 -

    Greg Hinch

    YUI Contributor

    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.

    • Tags:
    • greghinch
    • datatable
    • group
    • table
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    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.

    Code Sample

    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"
    });

    © 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