[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/jquery/handsontable/extensions/ -> jquery.handsontable.removeRow.js (source)

   1  (function ($) {
   2    "use strict";
   3    /**
   4     * Handsontable RemoveRow extension. See `demo/buttons.html` for example usage
   5     * @param {Object} instance
   6     * @param {Array|Boolean} [labels]
   7     */
   8    Handsontable.extension.RemoveRow = function (instance, labels) {
   9      var that = this;
  10      this.priority = 1;
  11      this.className = 'htRemoveRow htNoFrame';
  12      this.instance = instance;
  13      this.labels = labels;
  14  
  15      instance.blockedCols.main.on('mousedown', 'th.htRemoveRow .btn', function () {
  16        instance.alter("remove_row", $(this).parents('tr').index());
  17      });
  18      instance.container.on('mouseover', 'tbody th, tbody td', function () {
  19        that.getButton(this).show();
  20      });
  21      instance.container.on('mouseout', 'tbody th, tbody td', function () {
  22        that.getButton(this).hide();
  23      });
  24  
  25      instance.blockedCols.addHeader(this);
  26      instance.container.addClass('htRemoveRow');
  27    };
  28  
  29    /**
  30     * Return custom row label or automatically generate one
  31     * @param {Number} index Row index
  32     * @return {String}
  33     */
  34    Handsontable.extension.RemoveRow.prototype.columnLabel = function (index) {
  35      return '<div class="btn">x</div>';
  36    };
  37  
  38    /**
  39     * Return button object for a given TD or TH
  40     * @param {Element} td
  41     * @return {jQuery}
  42     */
  43    Handsontable.extension.RemoveRow.prototype.getButton = function (td) {
  44      return this.instance.blockedCols.main.find('th.htRemoveRow .btn').eq($(td.parentNode).index());
  45    };
  46  })(jQuery);


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1