How to use the handsontable.Dom function in handsontable

To help you get started, we’ve selected a few handsontable examples, based on popular ways it is used in public projects.

github timwis / handsontable-postgrest / src / select-editor.js View on Github external
SelectEditor.prototype.open = function () {
  var width = Handsontable.Dom.outerWidth(this.TD)
  var height = Handsontable.Dom.outerHeight(this.TD)
  var rootOffset = Handsontable.Dom.offset(this.instance.rootElement)
  var tdOffset = Handsontable.Dom.offset(this.TD)

  // sets <select> dimensions to match cell size
  this.select.style.height = height + 'px'
  this.select.style.width = width + 'px'

  // make sure that <select> position matches cell position
  this.select.style.top = tdOffset.top - rootOffset.top + 'px'
  this.select.style.left = tdOffset.left - rootOffset.left + 'px'
  this.select.style.margin = '0'

  // display the <select>
  this.select.style.display = ''
}
github timwis / handsontable-postgrest / src / select-editor.js View on Github external
Promise.resolve(optionsPromise).then(function (options) {
    Handsontable.Dom.empty(context.select) // clear select of existing options

    // Convert object to array of objects
    if (typeof options === 'object' && !Array.isArray(options)) {
      var optionsArray = []
      for (var option in options) {
        optionsArray.push({value: option, label: options[option]})
      }
      options = optionsArray
    }
    options.forEach(function (option) {
      var label = option.label || option.value || option
      var value = option.value || option.label || option

      var optionEl = document.createElement('option')
      optionEl.value = value
      Handsontable.Dom.fastInnerHTML(optionEl, label)
github timwis / handsontable-postgrest / src / select-editor.js View on Github external
SelectEditor.prototype.init = function () {
  this.select = document.createElement('select')
  Handsontable.Dom.addClass(this.select, 'select-editor')
  this.select.style.display = 'none'
  this.instance.rootElement.appendChild(this.select)
}
github timwis / handsontable-postgrest / src / select-editor.js View on Github external
options.forEach(function (option) {
      var label = option.label || option.value || option
      var value = option.value || option.label || option

      var optionEl = document.createElement('option')
      optionEl.value = value
      Handsontable.Dom.fastInnerHTML(optionEl, label)
      this.select.appendChild(optionEl)
    }, context)