How to use handsontable - 10 common examples

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

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Graphite-Docs / graphite / node_modules / handsontable-pro / src / plugins / filters / component / condition.js View on Github external
reset() {
    const lastSelectedColumn = this.hot.getPlugin('filters').getSelectedColumn();
    const visualIndex = lastSelectedColumn && lastSelectedColumn.visualIndex;
    const columnType = this.hot.getDataType.apply(this.hot, this.hot.getSelectedLast() || [0, visualIndex]);
    const items = getOptionsList(columnType);

    arrayEach(this.getInputElements(), (element) => element.hide());
    this.getSelectElement().setItems(items);
    super.reset();
    // Select element as default 'None'
    this.getSelectElement().setValue(items[0]);
  }
github Graphite-Docs / graphite / node_modules / handsontable-pro / src / plugins / trimRows / trimRows.js View on Github external
onBeforeRemoveRow(index, amount) {
    this.removedRows.length = 0;

    if (index !== false) {
      // Collect physical row index.
      rangeEach(index, index + amount - 1, (removedIndex) => {
        this.removedRows.push(this.hot.runHooks('modifyRow', removedIndex, this.pluginName));
      });
    }
  }
github Graphite-Docs / graphite / node_modules / handsontable-pro / src / plugins / filters / ui / multipleSelect.js View on Github external
let hotInitializer = (wrapper) => {
      if (!this._element) {
        return;
      }
      if (this.itemsBox) {
        this.itemsBox.destroy();
      }

      addClass(wrapper, 'htUIMultipleSelectHot');
      // Construct and initialise a new Handsontable
      this.itemsBox = new this.hot.constructor(wrapper, {
        data: this.items,
        columns: [
          {data: 'checked', type: 'checkbox', label: {property: 'visualValue', position: 'after'}}
        ],
        beforeRenderer: (TD, row, col, prop, value, cellProperties) => {
          TD.title = cellProperties.instance.getDataAtRowProp(row, cellProperties.label.property);
        },
        autoWrapCol: true,
        colWidths: 187,
        height: 110,
        width: 187,
        copyPaste: false,
        disableVisualSelection: 'area',
        fillHandle: false,
github Graphite-Docs / graphite / node_modules / handsontable-pro / es / plugins / filters / ui / multipleSelect.js View on Github external
var hotInitializer = function hotInitializer(wrapper) {
        if (!_this3._element) {
          return;
        }
        if (_this3.itemsBox) {
          _this3.itemsBox.destroy();
        }

        addClass(wrapper, 'htUIMultipleSelectHot');
        // Construct and initialise a new Handsontable
        _this3.itemsBox = new _this3.hot.constructor(wrapper, {
          data: _this3.items,
          columns: [{ data: 'checked', type: 'checkbox', label: { property: 'visualValue', position: 'after' } }],
          beforeRenderer: function beforeRenderer(TD, row, col, prop, value, cellProperties) {
            TD.title = cellProperties.instance.getDataAtRowProp(row, cellProperties.label.property);
          },
          autoWrapCol: true,
          colWidths: 187,
          height: 110,
          width: 187,
          copyPaste: false,
          disableVisualSelection: 'area',
          fillHandle: false,
          fragmentSelection: 'cell',
          tabMoves: { row: 1, col: 0 },
github valor-software / ng2-handsontable / demo / src / components / handsontable / sheet-demo.ts View on Github external
constructor() {
    this.data = Handsontable.helper['createSpreadsheetData'](100, 12); // tslint:disable-line:no-string-literal
    this.options = {
      height: 396,
      colHeaders: true,
      rowHeaders: true,
      stretchH: 'all',
      columnSorting: true,
      contextMenu: true
    };
  }
}
github tabixio / tabix / src / components / Handsontable / settingsMapper.js View on Github external
c.sortFunction=function (sortOrder) {
                    // Handsontable's object iteration helper
                    let objectEach = Handsontable.helper.objectEach;
                    let unitsRatios = {
                        'TiB': 1024*1024*1024*1024,
                        'GiB': 1024*1024*1024,
                        'MiB': 1024*1024,
                        'KiB': 1024,
                        'B': 1,
                    };
                    let parseUnit = function(value, unit, ratio) {
                        if (isNil(value)) return value;
                        if (isNaN(value) && value.indexOf(' ' + unit) > -1) {
                            value = parseFloat(value.replace(unit, '')) * ratio;
                        }
                        return value;
                    };
github kpi-intelligence / handsontable-key-value / src / filters / keyValueComponent.js View on Github external
visualcol: visualIndex,
        prop: columnSettings.data,
        row: null,
        visualRow: null,
      };

      getSourceItems.call(cellProperties, columnSettings.source, (items) => {
        // Prepare the items with key and value properties to be handled by intersectValues transparently
        const visibleValues = items.map(item => ({
          key: item[columnSettings.keyProperty],
          value: item[columnSettings.valueProperty],
        }));
        callback(visibleValues);
      });
    } else {
      const visibleValues = Handsontable.helper.arrayMap(
        this.hot.getDataAtCol(visualIndex),
        v => toEmptyString(v),
      );
      callback(visibleValues);
    }
  }
github hand-dot / taskontable / src / containers / Activity.js View on Github external
componentDidMount() {
    const { userId } = this.props;
    if (!userId) return;
    const self = this;
    // この画面だけで使う日付のカラムを追加
    hotConf.columns.unshift({
      title: `日付(${constants.DATEFMT})`,
      data: 'date',
      type: 'date',
      dateFormat: constants.DATEFMT,
      colWidths: 70,
    });
    this.hot = new Handsontable(this.hotDom, Object.assign({}, hotConf, {
      userId,
      isActiveNotifi: false,
      renderAllRows: true,
      height: 300,
      colWidths: Math.round(window.innerWidth / hotConf.columns.length),
      minRows: 10,
      data: [],
      afterRender() { self.syncStateByRender(); },
    }));
  }
github JBEI / edd / typescript / src / GCMS_Workbench.ts View on Github external
if (row === 0 || row === 1) {
                cellProperties.renderer = firstRowRenderer; // uses function directly
            } else if (col === 0) {
                cellProperties.renderer = Handsontable.renderers.TextRenderer;
            } else {
                cellProperties.renderer = Handsontable.renderers.NumericRenderer;
                if ($("#tableview").data("relative_areas") === true) {
                    cellProperties.format = "0.00000";
                }
            }
            return cellProperties;
        },
    };
    const container = $("#tableview");
    container.empty();
    const table = new Handsontable(container[0], settings);
    load_data(table, data, errors);
    return table;
}
github JBEI / edd / typescript / src / Study-Lines.ts View on Github external
function setupTable() {
    const container = document.getElementById("studyLinesTable");
    const columns = Config.columns(access);
    // Handsontable.hooks.add("afterInit", onLineTableLoad);
    const table = new Handsontable(container, {
        "afterChange": Config.handleChange(access, container),
        "afterInit": onLineTableLoad,
        "afterGetColHeader": Config.disableMenuFirstColumn,
        "allowInsertRow": false,
        "allowInsertColumn": false,
        "allowRemoveRow": false,
        "allowRemoveColumn": false,
        "beforeColumnMove": Config.disableMoveFirstColumn,
        "beforeStretchingColumnWidth": Config.disableResizeFirstColumn,
        "colHeaders": columns.map((c) => c.header),
        "columns": columns,
        "data": access.lines(),
        // TODO: add additional menu items, filtering, etc.
        "dropdownMenu": ["alignment"],
        "filters": true,
        // freeze the first column