migration.mustache revision 8bd9b02c76091e87124abd4afa3d798e637abb3c
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User#docs-main li {
f0aad5341752aefe5059832f6cf3abc3283c6e16Tinderbox User margin: 1ex 0;
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User white-space: nowrap;
d6fa26d0adaec6c910115be34fe7a5a5f402c14fMark Andrews background: #fcfbfa;
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User border: 1px solid #d0d5ec;
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User padding: 0 3px;
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User border-color: #efeeed;
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User.yui3-skin-sam table {
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User.yui3-skin-sam td,
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User.yui3-skin-sam th {
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User border: 0 none;
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User.demo { width: 40%; }
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User.details { width: 60%; }
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User.before, .after { width: 47%; }
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User margin-left: 5%;
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User#quickref code em {
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User#quickref code strong {
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User margin-top: 0;
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User margin-bottom: 0;
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<div class="intro">
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User DataTable and supporting modules were rebuilt in version 3.5.0. The
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User new architecture is <strong>not fully backward compatible</strong> with
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User versions 3.4.1 and prior. This guide is to help answer questions that
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User may come up when upgrading to the latest version.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User This guide focuses on 3.4.1 API compatibility. It <strong>does not
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User describe new features added in 3.5.0</strong> (there were a lot).
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User Refer to the updated <a href="index.html">DataTable user guide</a> for
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User If you are unable to upgrade due to unresolvable issues, you can use the
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <a href="../datatable-deprecated/index.html">`datatable-deprecated`</a>
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User module suite, which is equivalent to the 3.4.1 implementation. But be
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User aware that these modules will be removed in a future version of YUI.
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<h2 id="overview">Overview of API changes from 3.4.1</h2>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User The architectural change resulted in the deprecation, replacement, or
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User removal of nearly all attributes and properties from the version 3.4.1
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User implementation. Here is a quick list of the changes most likely to affect
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User your upgrade:
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User<ol id="quickref">
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User <code>new <em>Y.DataTable.Base</em>(...)</code> →
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User <code>new <strong>Y.DataTable</strong>({ ... })</code>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User <div class="yui3-g">
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <div class="yui3-u">
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User columnset: [ ... ],
7e71f05d8643aca84914437c900cb716444507e4Tinderbox User recordset: [ ... ]
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User <p class="yui3-u" style="line-height: 72px; margin: 0 1em;">→</p>
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User <div class="yui3-u">
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User columns: [ ... ],
7911e6f9de303bca5a3d8b34f4330c8f7cecffaeTinderbox User data : [ ... ]
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User (cells rendered as HTML by default) →
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <code>columns: [ { key: 'email', <strong>allowHTML: true</strong> }, ... ]</code>
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <code>table.plug(<em>Y.Plugin.DataTableSort</em>)</code> → <em>(plugin not needed)</em>
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <a href="#features">See below</a> or read
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <a href="index.html#sorting">the user guide</a>
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <code>table.plug(<em>Y.Plugin.DataTableScroll</em>, ...)</code> →
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <em>(plugin not needed)</em>
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <a href="#features">See below</a> or read
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <a href="index.html#scrolling">the user guide</a>
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <code>columnset: [ { <em>formatter: function (o) { ... }</em> } ]</code>
1ca759b3f5c0672b2a66bc02288fe010cabbfe37Tinderbox User (formatter changes)
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <a href="#formatters">See below</a> or read
1e9517ea2156b990be21f44676d3370318eacf17Tinderbox User <a href="index.html#scrolling">the user guide</a>
As of 3.5.0, `Y.DataTable` is no longer just a namespace, but is now the
var table = new Y.DataTable({
return years - (o.value < now);
The `Y.DataTable.Base` class still exists, but is useful primarily as a
superclass for extension. The attributes of `Y.DataTable.Base` are the
same as those of `Y.DataTable`, less any attributes added by class
or override the `Y.DataTable.BodyView` instance's `CELL_TEMPLATE`.
or override the `Y.DataTable.HeaderView` instance's `CELL_TEMPLATE`.
the `Y.DataTable.BodyView` instance's `ROW_TEMPLATE`.
`o.column` in the formatter parameter is now <a href="#columns">the
than a `Y.Column` instance.
`o.record` in the formatter parameter is now <a href="#data">a Model
instance</a> instead of a `Y.Record` instance.
<a href="index.html#nodeformatter">`nodeFormatter`</a>s.
var table = new Y.DataTable.Base({
if (o.value > 4) {
o.classnames += "spendy";
return '$' + o.value.toFixed(2);
var cell = this.createCell(o);
if (o.value > 4) {
cell.addClass('spendy');
var table = new Y.DataTable({
if (o.value > 4) {
o.className += "spendy";
return '$' + o.value.toFixed(2);
if (o.value > 4) {
o.cell.addClass('spendy');
Read the <a href="index.html#formatters">Formatting Cell Data</a> section in
var table = new Y.DataTable({
var columns = table.get('columns'); // => Array, not Columnset instance
table.set('columnset', [ ... (new column configurations) ... ]);
var columnset = table.get('columnset'); // => Array, not Columnset instance
See the <a href="index.html#columns">Column configuration</a> section in
a `Y.Recordset` instance</em>.
var table = new Y.DataTable({
var data = table.get('data'); // => ModelList instance
table.set('recordset', [ ... (new data records) ... ]);
var recordset = table.get('recordset'); // => ModelList, not Recordset
`Y.Record` stores all values in a single attribute named `data`, where `Y.Model` uses individual attributes for each value.
// Y.Record
var record = oldTable.get('recordset').item(0);
record.getValue('birthdate'); // => Date(1940, 1, 6)
record.get('data').birthdate; // => same
// Y.Model
var model = newTable.getRecord(0);
model.get('birthdate'); // => Date(1940, 1, 6)
<strong>This change breaks column/record keys that contain periods</strong>.
that is parsed by `Y.Plugin.DataSourceJSONSchema`, use the `locator`
var table = new Y.DataTable.Base({
{ key: "Product.Name", label: "Product" },
{ key: "Product.Price", label: "Price" }
}).plug(Y.Plugin.DataTableDataSource, {
datasource: new Y.DataSource.IO({
source: "/service/price-list"
}).plug(Y.Plugin.DataSourceJSONSchema, {
{ key: "Product.Name" },
{ key: "Product.Price" }
table.datasource.load(...);
var table = new Y.DataTable({
}).plug(Y.Plugin.DataTableDataSource, {
datasource: new Y.DataSource.IO({
source: "/service/price-list"
}).plug(Y.Plugin.DataSourceJSONSchema, {
locator: "Product.Name" },
locator: "Product.Price" }
table.datasource.load(...);
<dt>`Y.Plugin.RecordsetSort`</dt>
This plugin was formerly applied by the `Y.Plugin.DataTableSort` plugin
<dt>`Y.Plugin.RecordsetFilter`</dt>
<dt>`Y.Plugin.RecordsetIndexer`</dt>
<a href="../model/index.html">the Model user guide</a> for more
extensions for `Y.DataTable`. Simply including the `datatable-sort` or
var table = new Y.DataTable({
table.render('#over-there');
var table = new Y.DataTable.Base({
table.render('#sort-demo');
var table = new Y.DataTable({
table.render('#sort-demo');
table.sort("name");
var table = new Y.DataTable({
var table = new Y.DataTable({
var table = new Y.DataTable({ ... }).render("#over-there");
table._sortHandle = table.delegate(["dblclick", "keydown"],
See the <a href="index.html#sorting">Column Sorting section</a> of the
(now deprecated) `Y.Plugin.DataTableScroll` plugin.
var table = new Y.DataTable.Base({
table.render("#over-there");
var table = new Y.DataTable({
<th id="(guid)" colspan="1" rowspan="1" class="yui3-datatable-header yui3-datatable-first-header yui3-datatable-col-id" scope="col" data-yui3-col-id="id">
<th id="(guid)" colspan="1" rowspan="1" class="yui3-datatable-header yui3-datatable-col-name" scope="col" data-yui3-col-id="name">
<th id="(guid)" colspan="1" rowspan="1" class="yui3-datatable-header yui3-datatable-col-price" scope="col" data-yui3-col-id="price">
something important, please <a href="/projects/yui3/newticket">file a
<a href="/forum">forums</a>, and the #yui IRC channel on freenode.net.