import type { HotInstance } from './core/types'; /** * Handsontable constructor. * * @core * @class Core * @description * * The `Handsontable` class (known as the `Core`) lets you modify the grid's behavior by using Handsontable's public API methods. * * ::: only-for react * To use these methods, associate a Handsontable instance with your instance * of the [`HotTable` component](@/guides/getting-started/installation/installation.md#_4-use-the-hottable-component), * by using React's `ref` feature (read more on the [Instance methods](@/guides/getting-started/react-methods/react-methods.md) page). * ::: * * ::: only-for angular * To use these methods, associate a Handsontable instance with your instance * of the [`HotTable` component](@/guides/getting-started/installation/installation.md#5-use-the-hottable-component), * by using `@ViewChild` decorator (read more on the [Instance access](@/guides/getting-started/angular-hot-instance/angular-hot-instance.md) page). * ::: * * ## How to call a method * * ::: only-for javascript * ```js * // create a Handsontable instance * const hot = new Handsontable(document.getElementById('example'), options); * * // call a method * hot.setDataAtCell(0, 0, 'new value'); * ``` * ::: * * ::: only-for react * ```jsx * import { useRef } from 'react'; * * const hotTableComponent = useRef(null); * * * * // access the Handsontable instance, under the `.current.hotInstance` property * // call a method * hotTableComponent.current.hotInstance.setDataAtCell(0, 0, 'new value'); * ``` * ::: * * ::: only-for angular * ```ts * import { Component, ViewChild, AfterViewInit } from "@angular/core"; * import { * GridSettings, * HotTableComponent, * HotTableModule, * } from "@handsontable/angular-wrapper"; * * `@Component`({ * standalone: true, * imports: [HotTableModule], * template: `
* *
`, * }) * export class ExampleComponent implements AfterViewInit { * `@ViewChild`(HotTableComponent, { static: false }) * readonly hotTable!: HotTableComponent; * * readonly gridSettings = { * columns: [{}], * }; * * ngAfterViewInit(): void { * // Access the Handsontable instance * // Call a method * this.hotTable?.hotInstance?.setDataAtCell(0, 0, "new value"); * } * } * ``` * ::: * * @param {HTMLElement} rootContainer The element to which the Handsontable instance is injected. * @param {object} userSettings The user defined options. * @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created. */ export default function Core(this: HotInstance, rootContainer: HTMLElement, userSettings: Record & { initialState?: Record; }, rootInstanceSymbol?: symbol | boolean): void;