How to use the handsontable.helper 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 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 handsontable / react-handsontable / test / autoSizeWarning.spec.tsx View on Github external
'the `columns` option is defined as a function', async (done) => {
    console.warn = jasmine.createSpy('warn');

    const wrapper: ReactWrapper<{}, {}, typeof HotTable> = mount(
      
        
        
        
      , {attachTo: document.body.querySelector('#hotContainer')}
github handsontable / react-handsontable / test / hotColumn.spec.tsx View on Github external
it('should use the renderer component as Handsontable renderer, when it\'s nested under HotColumn and assigned the \'hot-renderer\' attribute', async (done) => {
    const wrapper: ReactWrapper<{}, {}, typeof HotTable> = mount(
      
        
        
          
        
      , {attachTo: document.body.querySelector('#hotContainer')}
    );
github handsontable / react-handsontable / test / hotTable.spec.tsx View on Github external
it('should use the editor component as Handsontable editor, when it\'s nested under HotTable and assigned the \'hot-editor\' attribute', async (done) => {
    const wrapper: ReactWrapper<{}, {}, typeof HotTable> = mount(
      
        
      , {attachTo: document.body.querySelector('#hotContainer')}
    );

    await sleep(100);

    const hotInstance = wrapper.instance().hotInstance;

    expect((document.querySelector('#editorComponentContainer') as any).style.display).toEqual('none');
github handsontable / react-handsontable / test / componentInternals.spec.tsx View on Github external
render(): React.ReactElement {
        return (
          <div id="{this.props.editorId}">
            {this.state.value}
          </div>
        );
      }
    }

    let globalEditorInstance = null;
    let columnEditorInstance = null;
    const wrapper: ReactWrapper&lt;{}, {}, typeof HotTable&gt; = mount(
      
        
        
github handsontable / react-handsontable / test / reactHooks.spec.tsx View on Github external
const [count, setCount] = useState(0);

      return (
        <div>
          <p>{props.value}</p>: <span>{count}</span>
          <button> setCount(count + 1)}&gt;
            Click me
          </button>
        </div>
      );
    }

    const wrapper: ReactWrapper&lt;{}, {}, typeof HotTable&gt; = mount(
      
        
      , {attachTo: document.body.querySelector('#hotContainer')}
    );

    await sleep(100);

    const hotInstance = wrapper.instance().hotInstance;
github handsontable / react-handsontable / test / reactContext.spec.tsx View on Github external
class EditorComponent3 extends React.Component {
      render() {
        return (
          &lt;&gt;
            {this.context}
          
        )
      }
    }
    EditorComponent3.contextType = TestContext;

    const wrapper: ReactWrapper&lt;{}, {}, typeof HotTable&gt; = mount(
      
        
          
            
github handsontable / angular-handsontable / projects / hot-table / src / lib / hot-table.component.spec.ts View on Github external
await TestBed.compileComponents().then(() => {
      fixture = TestBed.createComponent(TestComponent);
      const app = fixture.componentInstance;

      app.prop['settings'] = {
        data: Handsontable.helper.createSpreadsheetData(5, 5)
      };

      fixture.detectChanges();
      expect(app.getHotInstance(app.id).getDataAtCell(0, 0)).toBe('A1');
    });
  });