How to use the handsontable/helpers/array.arrayMap 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.

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 / filters.js View on Github external
onBeforeDropdownMenuSetItems(items) {
    const menuKeys = arrayMap(items, (item) => item.key);

    this.components.forEach((component) => {
      component[menuKeys.indexOf(component.getMenuItemDescriptor().key) === -1 ? 'hide' : 'show']();
    });

    this.initHiddenRowsCache();
  }
github Graphite-Docs / graphite / node_modules / handsontable-pro / src / plugins / filters / filters.js View on Github external
filter() {
    let dataFilter = this._createDataFilter();
    let needToFilter = !this.conditionCollection.isEmpty();
    let visibleVisualRows = [];

    const conditions = this.conditionCollection.exportAllConditions();
    const allowFiltering = this.hot.runHooks('beforeFilter', conditions);

    if (allowFiltering !== false) {
      if (needToFilter) {
        let trimmedRows = [];

        this.trimRowsPlugin.trimmedRows.length = 0;

        visibleVisualRows = arrayMap(dataFilter.filter(), (rowData) => rowData.meta.visualRow);

        const visibleVisualRowsAssertion = createArrayAssertion(visibleVisualRows);

        rangeEach(this.hot.countSourceRows() - 1, (row) => {
          if (!visibleVisualRowsAssertion(row)) {
            trimmedRows.push(row);
          }
        });

        this.trimRowsPlugin.trimRows(trimmedRows);

        if (!visibleVisualRows.length) {
          this.hot.deselectCell();
        }
      } else {
        this.trimRowsPlugin.untrimAll();
github Graphite-Docs / graphite / node_modules / handsontable-pro / es / plugins / filters / filters.js View on Github external
value: function filter() {
      var dataFilter = this._createDataFilter();
      var needToFilter = !this.conditionCollection.isEmpty();
      var visibleVisualRows = [];

      var conditions = this.conditionCollection.exportAllConditions();
      var allowFiltering = this.hot.runHooks('beforeFilter', conditions);

      if (allowFiltering !== false) {
        if (needToFilter) {
          var trimmedRows = [];

          this.trimRowsPlugin.trimmedRows.length = 0;

          visibleVisualRows = arrayMap(dataFilter.filter(), function (rowData) {
            return rowData.meta.visualRow;
          });

          var visibleVisualRowsAssertion = createArrayAssertion(visibleVisualRows);

          rangeEach(this.hot.countSourceRows() - 1, function (row) {
            if (!visibleVisualRowsAssertion(row)) {
              trimmedRows.push(row);
            }
          });

          this.trimRowsPlugin.trimRows(trimmedRows);

          if (!visibleVisualRows.length) {
            this.hot.deselectCell();
          }
github Graphite-Docs / graphite / node_modules / handsontable-pro / src / plugins / filters / ui / multipleSelect.js View on Github external
function valueToItems(availableItems, selectedValue) {
  const arrayAssertion = createArrayAssertion(selectedValue);

  return arrayMap(availableItems, (item) => {
    item.checked = arrayAssertion(item.value);

    return item;
  });
}
github Graphite-Docs / graphite / node_modules / handsontable-pro / es / plugins / filters / filters.js View on Github external
value: function onBeforeDropdownMenuSetItems(items) {
      var menuKeys = arrayMap(items, function (item) {
        return item.key;
      });

      this.components.forEach(function (component) {
        component[menuKeys.indexOf(component.getMenuItemDescriptor().key) === -1 ? 'hide' : 'show']();
      });

      this.initHiddenRowsCache();
    }
github Graphite-Docs / graphite / node_modules / handsontable-pro / es / plugins / filters / ui / multipleSelect.js View on Github external
function valueToItems(availableItems, selectedValue) {
  var arrayAssertion = createArrayAssertion(selectedValue);

  return arrayMap(availableItems, function (item) {
    item.checked = arrayAssertion(item.value);

    return item;
  });
}