NOBUG: Fixed file access permissions
[moodle.git] / lib / yuilib / 3.13.0 / datatable-foot / datatable-foot-debug.js
blob1aadd9bc083b291e3b5f255524fbb8eb4f6c5b1f
1 /*
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/
6 */
8 YUI.add('datatable-foot', function (Y, NAME) {
10 /**
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`
13 classes.
15 @module datatable
16 @submodule datatable-foot
17 @since 3.11.0
18 **/
21 Y.namespace('DataTable').FooterView = Y.Base.create('tableFooter', Y.View, [], {
22     // -- Instance properties -------------------------------------------------
24     /**
25     HTML templates used to create the `<tfoot>` containing the table footers.
27     @property TFOOT_TEMPLATE
28     @type {HTML}
29     @default '<tfoot class="{className}"/>'
30     @since 3.11.0
31     **/
32     TFOOT_TEMPLATE: '<tfoot class="{className}"/>',
34     // -- Public methods ------------------------------------------------------
36     /**
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`.
44     @method getClassName
45     @param {String} token* Any number of token strings to assemble the
46         classname from.
47     @return {String}
48     @protected
49     @since 3.11.0
50     **/
51     getClassName: function () {
52         // TODO: add attribute with setter? to host to use property this.host
53         // for performance
54         var host = this.host,
55             NAME = (host && host.constructor.NAME) ||
56                     this.constructor.NAME;
58         if (host && host.getClassName) {
59             return host.getClassName.apply(host, arguments);
60         } else {
61             return Y.ClassNameManager.getClassName
62                 .apply(Y.ClassNameManager,
63                        [NAME].concat(Y.Array(arguments, 0, true)));
64         }
65     },
67     /**
68     Creates the `<tfoot>` Node and inserts it after the `<thead>` Node.
70     @method render
71     @return {FooterView} The instance
72     @chainable
73     @since 3.11.0
74     **/
75     render: function () {
76         var tfoot    = this.tfootNode ||
77                         (this.tfootNode = this._createTFootNode());
79         if (this.host && this.host._theadNode) {
80             this.host._theadNode.insert(tfoot, 'after');
81         }
83         return this;
84     },
86     /**
87     Creates the `<tfoot>` node that will store the footer rows and cells.
89     @method _createTFootNode
90     @return {Node}
91     @protected
92     @since 3.11.0
93     **/
94     _createTFootNode: function () {
95         return Y.Node.create(Y.Lang.sub(this.TFOOT_TEMPLATE, {
96             className: this.getClassName('foot')
97         }));
98     },
100     /**
101     Initializes the instance. Reads the following configuration properties:
103       * `host`    - The object to serve as source of truth for column info
105     @method initializer
106     @param {Object} config Configuration data
107     @protected
108     @since 3.11.0
109     **/
110     initializer: function (config) {
111         this.host  = (config && config.host);
112     }
119 }, '3.13.0', {"requires": ["datatable-core", "view"]});