Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'datatable-header-title' of git://github.com/jafl/yui3 i…
…nto jafl-datatable-header-title
  • Loading branch information
ericf committed Oct 30, 2012
2 parents 474940b + de09a4a commit 09e5341
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/datatable/docs/index.mustache
Expand Up @@ -1809,6 +1809,21 @@ pies.on('pie:slicesChange', function (e) {
</td>
<td>`datatable-base`</td>
</tr>
<tr>
<td>title</td>
<td>
```
{
key : 'forecast',
label: '1yr Target Forecast',
title: 'Target Forecast for the Next 12 Months'
}
```

<p>Assigns the value `<th title="HERE">`.</p>
</td>
<td>`datatable-base`</td>
</tr>
<tr>
<td>headerTemplate</td>
<td>
Expand Down
15 changes: 11 additions & 4 deletions src/datatable/js/head.js
Expand Up @@ -56,6 +56,7 @@ Supported properties of the column objects include:
* `headerTemplate` - Overrides the instance's `CELL_TEMPLATE` for cells in this
column only.
* `abbr` - The content of the 'abbr' attribute of the `<th>`
* `title` - The content of the 'title' attribute of the `<th>`
* `className` - Adds this string of CSS classes to the column header
Through the life of instantiation and rendering, the column objects will have
Expand Down Expand Up @@ -85,11 +86,11 @@ Y.namespace('DataTable').HeaderView = Y.Base.create('tableHeader', Y.View, [], {
@property CELL_TEMPLATE
@type {HTML}
@default '<th id="{id}" colspan="{_colspan}" rowspan="{_rowspan}" class="{className}" scope="col" {_id}{abbr}>{content}</th>'
@default '<th id="{id}" colspan="{_colspan}" rowspan="{_rowspan}" class="{className}" scope="col" {_id}{abbr}{title}>{content}</th>'
@since 3.5.0
**/
CELL_TEMPLATE:
'<th id="{id}" colspan="{_colspan}" rowspan="{_rowspan}" class="{className}" scope="col" {_id}{abbr}>{content}</th>',
'<th id="{id}" colspan="{_colspan}" rowspan="{_rowspan}" class="{className}" scope="col" {_id}{abbr}{title}>{content}</th>',

/**
The data representation of the header rows to render. This is assigned by
Expand Down Expand Up @@ -189,7 +190,8 @@ Y.namespace('DataTable').HeaderView = Y.Base.create('tableHeader', Y.View, [], {
defaults = {
_colspan: 1,
_rowspan: 1,
abbr: ''
abbr: '',
title: ''
},
i, len, j, jlen, col, html, content, values;

Expand All @@ -213,11 +215,15 @@ Y.namespace('DataTable').HeaderView = Y.Base.create('tableHeader', Y.View, [], {

values._id = col._id ?
' data-yui3-col-id="' + col._id + '"' : '';

if (col.abbr) {
values.abbr = ' abbr="' + col.abbr + '"';
}

if (col.title) {
values.title = ' title="' + col.title + '"';
}

if (col.className) {
values.className += ' ' + col.className;
}
Expand Down Expand Up @@ -377,6 +383,7 @@ Y.namespace('DataTable').HeaderView = Y.Base.create('tableHeader', Y.View, [], {
* `children` - Array of columns to appear below this column in the next
row.
* `abbr` - The content of the 'abbr' attribute of the `<th>`
* `title` - The content of the 'title' attribute of the `<th>`
* `headerTemplate` - Overrides the instance's `CELL_TEMPLATE` for cells
in this column only.
Expand Down

0 comments on commit 09e5341

Please sign in to comment.