[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/yuilib/3.17.2/datatable-foot/ -> datatable-foot-debug.js (source)

   1  /*
   2  YUI 3.17.2 (build 9c3c78e)
   3  Copyright 2014 Yahoo! Inc. All rights reserved.
   4  Licensed under the BSD License.
   5  http://yuilibrary.com/license/
   6  */
   7  
   8  YUI.add('datatable-foot', function (Y, NAME) {
   9  
  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.
  14  
  15  @module datatable
  16  @submodule datatable-foot
  17  @since 3.11.0
  18  **/
  19  
  20  
  21  Y.namespace('DataTable').FooterView = Y.Base.create('tableFooter', Y.View, [], {
  22      // -- Instance properties -------------------------------------------------
  23  
  24      /**
  25      HTML templates used to create the `<tfoot>` containing the table footers.
  26  
  27      @property TFOOT_TEMPLATE
  28      @type {String}
  29      @default '<tfoot class="{className}"/>'
  30      @since 3.11.0
  31      **/
  32      TFOOT_TEMPLATE: '<tfoot class="{className}"/>',
  33  
  34      // -- Public methods ------------------------------------------------------
  35  
  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.
  40  
  41      If `host` is absent or has neither method nor `NAME`, a CSS classname
  42      will be generated using this class's `NAME`.
  43  
  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;
  57  
  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      },
  66  
  67      /**
  68      Creates the `<tfoot>` Node and inserts it after the `<thead>` Node.
  69  
  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());
  78  
  79          if (this.host && this.host._theadNode) {
  80              this.host._theadNode.insert(tfoot, 'after');
  81          }
  82  
  83          return this;
  84      },
  85  
  86      /**
  87      Creates the `<tfoot>` node that will store the footer rows and cells.
  88  
  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      },
  99  
 100      /**
 101      Initializes the instance. Reads the following configuration properties:
 102  
 103        * `host`    - The object to serve as source of truth for column info
 104  
 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      }
 113  
 114  
 115  
 116  });
 117  
 118  
 119  }, '3.17.2', {"requires": ["datatable-core", "view"]});


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1