2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
8 YUI.add('datatable-foot', function (Y, NAME) {
11 View class responsible for rendering the `<tfoot>` section of a table. Can be
12 used as the default `footerView` for `Y.DataTable.Base` and `Y.DataTable`
16 @submodule datatable-foot
21 Y.namespace('DataTable').FooterView = Y.Base.create('tableFooter', Y.View, [], {
22 // -- Instance properties -------------------------------------------------
25 HTML templates used to create the `<tfoot>` containing the table footers.
27 @property TFOOT_TEMPLATE
29 @default '<tfoot class="{className}"/>'
32 TFOOT_TEMPLATE: '<tfoot class="{className}"/>',
34 // -- Public methods ------------------------------------------------------
37 Returns the generated CSS classname based on the input. If the `host`
38 attribute is configured, it will attempt to relay to its `getClassName`
39 or use its static `NAME` property as a string base.
41 If `host` is absent or has neither method nor `NAME`, a CSS classname
42 will be generated using this class's `NAME`.
45 @param {String} token* Any number of token strings to assemble the
51 getClassName: function () {
52 // TODO: add attribute with setter? to host to use property this.host
55 NAME = (host && host.constructor.NAME) ||
56 this.constructor.NAME;
58 if (host && host.getClassName) {
59 return host.getClassName.apply(host, arguments);
61 return Y.ClassNameManager.getClassName
62 .apply(Y.ClassNameManager,
63 [NAME].concat(Y.Array(arguments, 0, true)));
68 Creates the `<tfoot>` Node and inserts it after the `<thead>` Node.
71 @return {FooterView} The instance
76 var tfoot = this.tfootNode ||
77 (this.tfootNode = this._createTFootNode());
79 if (this.host && this.host._theadNode) {
80 this.host._theadNode.insert(tfoot, 'after');
87 Creates the `<tfoot>` node that will store the footer rows and cells.
89 @method _createTFootNode
94 _createTFootNode: function () {
95 return Y.Node.create(Y.Lang.sub(this.TFOOT_TEMPLATE, {
96 className: this.getClassName('foot')
101 Initializes the instance. Reads the following configuration properties:
103 * `host` - The object to serve as source of truth for column info
106 @param {Object} config Configuration data
110 initializer: function (config) {
111 this.host = (config && config.host);
119 }, '3.13.0', {"requires": ["datatable-core", "view"]});