• 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.

    Treeble (gallery-treeble) on cdn

    Last Updated: 04/3/13
    + 1 -

    John Lindal

    YUI Contributor

    See 50 more by this user.

    Created: 05/20/10
    Last CDN Push: 04/3/13
    Build Tag: gallery-2013.04.03-19-53
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.5.1
    Free for use.

    "Treeble" comes from merging "tree" and "table." The original motivation was to enable drilling into the details behind each row in a table, e.g., start with a table which displays sales figures for each continent and then drill into each country, region, and city. Of course, once I started building it, the natural design was to support any hierarchy of data.

    Treeble extends Y.DataTable, so all DataTable plugins work with Treebles.

    • Tags:
    • treeble
    • tree
    • jafl
    • datatable
    • table
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    An example of how to wire up TreebleDataSource. my_data is assumed to contain nested arrays, with 'kiddies' being the key for retrieving an item's children.

    Code Sample

    <script src="http://yui.yahooapis.com/3.5.1/build/yui/yui-min.js"></script>
    YUI({
        //Last Gallery Build of this module
        gallery: 'gallery-2013.04.03-19-53'
    }).use('gallery-treeble', function(Y) {
     
    	var my_data = [...];
     
    	// treeble config to be set on root datasource
     
    	var schema =
    	{
    		resultFields:
    		[
    			"id","quantity","year","title",
    			{key: 'kiddies', parser: 'treebledatasource'}
    		]
    	};
     
    	var schema_plugin_config =
    	{
    		fn:  Y.Plugin.DataSourceArraySchema,
    		cfg: {schema:schema}
    	};
     
    	var treeble_config =
    	{
    		generateRequest:        function() { },
    		schemaPluginConfig:     schema_plugin_config,
    		childNodesKey:          'kiddies',
    		totalRecordsReturnExpr: '.meta.totalRecords'
    	};
     
    	// root data source
     
    	var root            = new Y.DataSource.Local({source: data});
    	root.treeble_config = Y.clone(treeble_config, true);
    	root.plug(schema_plugin_config);
     
    	// TreebleDataSource
     
    	var ds = new Y.DataSource.Treeble(
    	{
    		root:             root,
    		paginateChildren: false,
    		uniqueIdKey:      'the-key-which-uniquely-identifies-each-record'
    	});
     
    	// request data
     
    	var callback =
    	{
    		success: function(e)
    		{
    			// do something with e.response.results
    		},
    		error: function()
    		{
    			// do something with e.error
    		}
    	};
     
    	ds.sendRequest(
    	{
    		request:
    		{
    			startIndex: 0,
    			resultCount: 10
    		},
    		callback: callback
    	});
    });

    Forum Posts

    Subject Author Date
    Default a node to open? Brian J. Miller 02/3/11
    Re: Default a node to open? John Lindal 04/11/11
    Re: Default a node to open? John Lindal 04/11/11
    Running locally Scott Vickery 12/1/11
    Re: Running locally Scott Vickery 12/1/11
    Treeble vs. datatable + add row Daniel Ji 03/1/12
    Re: Treeble vs. datatable + add row John Lindal 03/1/12
    Re: Treeble vs. datatable + add row Daniel Ji 03/1/12
    Re: Treeble vs. datatable + add row John Lindal 03/1/12
    Re: Treeble vs. datatable + add row Daniel Ji 03/1/12

    © 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