Sha256: 86d3b51e5bbb239135cd862f4d8913d89208a4bb1017e473292cd09e185aed6a

Contents?: true

Size: 1.44 KB

Versions: 30

Compression:

Stored size: 1.44 KB

Contents

(function ($) {
  // register namespace
  $.extend(true, window, {
    "Slick": {
      "CellRangeDecorator": CellRangeDecorator
    }
  });

  /***
   * Displays an overlay on top of a given cell range.
   *
   * TODO:
   * Currently, it blocks mouse events to DOM nodes behind it.
   * Use FF and WebKit-specific "pointer-events" CSS style, or some kind of event forwarding.
   * Could also construct the borders separately using 4 individual DIVs.
   *
   * @param {Grid} grid
   * @param {Object} options
   */
  function CellRangeDecorator(grid, options) {
    var _elem;
    var _defaults = {
      selectionCss: {
        "zIndex": "9999",
        "border": "2px dashed red"
      }
    };

    options = $.extend(true, {}, _defaults, options);


    function show(range) {
      if (!_elem) {
        _elem = $("<div></div>", {css: options.selectionCss})
            .css("position", "absolute")
            .appendTo(grid.getCanvasNode());
      }

      var from = grid.getCellNodeBox(range.fromRow, range.fromCell);
      var to = grid.getCellNodeBox(range.toRow, range.toCell);

      _elem.css({
        top: from.top - 1,
        left: from.left - 1,
        height: to.bottom - from.top - 2,
        width: to.right - from.left - 2
      });

      return _elem;
    }

    function hide() {
      if (_elem) {
        _elem.remove();
        _elem = null;
      }
    }

    $.extend(this, {
      "show": show,
      "hide": hide
    });
  }
})(jQuery);

Version data entries

30 entries across 29 versions & 4 rubygems

Version Path
omf_web-1.2.9 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-1.2.8 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-1.2.7 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-1.2.6 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-1.2.5 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-1.2.4 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-1.2.3 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-1.2.2 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-1.2.1 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-1.2.0 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-1.0.0 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
slickgrid-rails-0.3.1 vendor/assets/javascripts/slick/plugins/cellrangedecorator.js
slickgrid-rails-0.3.0 vendor/assets/javascripts/slick/plugins/cellrangedecorator.js
omf_web-0.9.9 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
omf_web-0.9.8 share/htdocs/vendor/slickgrid-200512/plugins/slick.cellrangedecorator.js
smartkiosk-server-0.13.1 vendor/assets/javascripts/slick.cellrangedecorator.js
smartkiosk-server-0.13 vendor/assets/javascripts/slick.cellrangedecorator.js
slickgrid-bootstrap-rails-0.0.3 vendor/assets/javascripts/plugins/slick.cellrangedecorator.js
slickgrid-bootstrap-rails-0.0.2 vendor/assets/javascripts/plugins/slick.cellrangedecorator.js
slickgrid-bootstrap-rails-0.0.1.10 vendor/assets/javascripts/plugins/slick.cellrangedecorator.js