Permalink
Browse files

Merge branch 'master' of github.com:lsmith/yui3

  • Loading branch information...
2 parents e08a0ec + fa74b1b commit 089645941ba506392738fec4128115392aba7716 @lsmith lsmith committed Jan 30, 2012
Showing with 1,071 additions and 540 deletions.
  1. +26 −15 build/datatable-body/datatable-body-debug.js
  2. +1 −1 build/datatable-body/datatable-body-min.js
  3. +26 −15 build/datatable-body/datatable-body.js
  4. +7 −0 build/datatable-core/datatable-core-debug.js
  5. +7 −0 build/datatable-core/datatable-core.js
  6. +25 −24 build/datatable-head/datatable-head-debug.js
  7. +1 −1 build/datatable-head/datatable-head-min.js
  8. +25 −24 build/datatable-head/datatable-head.js
  9. +5 −1 build/datatable-scroll/datatable-scroll-debug.js
  10. +1 −1 build/datatable-scroll/datatable-scroll-min.js
  11. +5 −1 build/datatable-scroll/datatable-scroll.js
  12. +4 −13 src/datatable/docs/datatable-dsio.mustache
  13. +57 −52 src/datatable/docs/datatable-formatting.mustache
  14. +15 −5 src/datatable/docs/datatable-nestedcols.mustache
  15. +35 −36 src/datatable/docs/datatable-scroll.mustache
  16. +26 −14 src/datatable/docs/datatable-sort.mustache
  17. +634 −224 src/datatable/docs/index.mustache
  18. +24 −11 src/datatable/docs/partials/datatable-dsio-source.mustache
  19. +6 −9 src/datatable/docs/partials/datatable-formatting-source.mustache
  20. +6 −2 src/datatable/docs/partials/datatable-nestedcols-source.mustache
  21. +26 −31 src/datatable/docs/partials/datatable-scroll-source.mustache
  22. +25 −3 src/datatable/docs/partials/datatable-sort-source.mustache
  23. +26 −15 src/datatable/js/body.js
  24. +7 −0 src/datatable/js/core.js
  25. +25 −24 src/datatable/js/head.js
  26. +5 −1 src/datatable/js/scroll.js
  27. +9 −1 src/panel/docs/partials/panel-form-css-source.mustache
  28. +9 −13 src/panel/docs/partials/panel-form-js-source.mustache
  29. +3 −3 src/yui/docs/partials/modules.mustache
@@ -46,6 +46,8 @@ Column `formatter`s are passed an object (`o`) with the following properties:
* `className` - Initially empty string to allow `formatter`s to add CSS
classes to the cell's `<td>`.
* `rowindex` - The zero-based row number.
+ * `rowClass` - Initially empty string to allow `formatter`s to add CSS
+ classes to the cell's containing row `<tr>`.
They may return a value or update `o.value` to assign specific HTML content. A
returned value has higher precedence.
@@ -129,10 +131,10 @@ Y.namespace('DataTable').BodyView = Y.Base.create('tableBody', Y.View, [], {
@property ROW_TEMPLATE
@type {HTML}
- @default '<tr id="{clientId}" class="{rowClasses}">{content}</tr>'
+ @default '<tr id="{clientId}" class="{rowClass}">{content}</tr>'
**/
ROW_TEMPLATE :
- '<tr role="row" id="{rowId}" class="{rowClasses}">' +
+ '<tr role="row" id="{rowId}" class="{rowClass}">' +
'{content}' +
'</tr>',
@@ -258,6 +260,8 @@ Y.namespace('DataTable').BodyView = Y.Base.create('tableBody', Y.View, [], {
* `className` - Initially empty string to allow `formatter`s to add CSS
classes to the cell's `<td>`.
* `rowindex` - The zero-based row number.
+ * `rowClass` - Initially empty string to allow `formatter`s to add CSS
+ classes to the cell's containing row `<tr>`.
They may return a value or update `o.value` to assign specific HTML
content. A returned value has higher precedence.
@@ -472,23 +476,24 @@ Y.namespace('DataTable').BodyView = Y.Base.create('tableBody', Y.View, [], {
supplemented by other template values to the instance's `_rowTemplate` (see
`_createRowTemplate`). The generated string is then returned.
- The data from Model's attributes is fetched by `getAttrs` and this data
+ The data from Model's attributes is fetched by `toJSON` and this data
object is appended with other properties to supply values to {placeholders}
in the template. For a template generated from a Model with 'foo' and 'bar'
attributes, the data object would end up with the following properties
before being used to populate the `_rowTemplate`:
* `clientID` - From Model, used the assign the `<tr>`'s 'id' attribute.
* `foo` - The value to populate the 'foo' column cell content. This
- value will be the result of the column's `formatter` if assigned, and
- will default from '' or `undefined` to the value of the column's
- `emptyCellValue` if assigned.
+ value will be the value stored in the Model's `foo` attribute, or the
+ result of the column's `formatter` if assigned. If the value is '' or
+ `undefined`, and the column's `emptyCellValue` is assigned, that value
+ will be used.
* `bar` - Same for the 'bar' column cell content.
* `foo-className` - String of CSS classes to apply to the `<td>`.
* `bar-className` - Same.
- * `rowClasses` - String of CSS classes to apply to the `<tr>`. This will
- default to the odd/even class per the specified index, but can be
- accessed and ammended by any column formatter via `o.data.rowClasses`.
+ * `rowClass` - String of CSS classes to apply to the `<tr>`. This
+ will be the odd/even class per the specified index plus any additional
+ classes assigned by column formatters (via `o.rowClass`).
Because this object is available to formatters, any additional properties
can be added to fill in custom {placeholders} in the `_rowTemplate`.
@@ -502,8 +507,8 @@ Y.namespace('DataTable').BodyView = Y.Base.create('tableBody', Y.View, [], {
_createRowHTML: function (model, index) {
var data = model.toJSON(),
values = {
- rowId: model.get('clientId'),
- rowClasses: (index % 2) ? this.CLASS_ODD : this.CLASS_EVEN
+ rowId : model.get('clientId'),
+ rowClass: (index % 2) ? this.CLASS_ODD : this.CLASS_EVEN
},
source = this.source || this,
columns = this.columns,
@@ -523,12 +528,15 @@ Y.namespace('DataTable').BodyView = Y.Base.create('tableBody', Y.View, [], {
column : col,
record : model,
className: '',
+ rowClass : '',
rowindex : index
};
if (typeof col.formatter === 'string') {
- // TODO: look for known formatters by string name
- value = fromTemplate(col.formatter, formatterData);
+ if (value !== undefined) {
+ // TODO: look for known formatters by string name
+ value = fromTemplate(col.formatter, formatterData);
+ }
} else {
// Formatters can either return a value
value = col.formatter.call(source, formatterData);
@@ -539,6 +547,7 @@ Y.namespace('DataTable').BodyView = Y.Base.create('tableBody', Y.View, [], {
}
values[token + '-className'] = formatterData.className;
+ values.rowClass += ' ' + formatterData.rowClass;
}
}
@@ -547,6 +556,8 @@ Y.namespace('DataTable').BodyView = Y.Base.create('tableBody', Y.View, [], {
}
values[token] = col.allowHTML ? value : htmlEscape(value);
+
+ values.rowClass = values.rowClass.replace(/\s+/g, ' ');
}
return fromTemplate(this._rowTemplate, values);
@@ -575,7 +586,7 @@ Y.namespace('DataTable').BodyView = Y.Base.create('tableBody', Y.View, [], {
tokenValues = {
content : '{' + token + '}',
- headers : col.headers.join(' '),
+ headers : (col._headers || []).join(' '),
className: this.getClassName('col', token) + ' ' +
(col.className || '') + ' ' +
this.getClassName('cell') +
@@ -584,7 +595,7 @@ Y.namespace('DataTable').BodyView = Y.Base.create('tableBody', Y.View, [], {
if (col.nodeFormatter) {
// Defer all node decoration to the formatter
- tokenValues.content = '';
+ tokenValues.content = '';
}
html += fromTemplate(cellTemplate, tokenValues);

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 0896459

Please sign in to comment.