This page covers a next version of Handsontable, and is not published yet.

This page covers a non-latest version of Handsontable.

# Using the HotColumn component in Vue 3

# Overview

You can configure column-related settings using the HotColumn component's attributes.

Find out which Vue 3 versions are supported

# Declaring column settings

To declare column-specific settings, pass the settings as hot-column properties, either separately or wrapped as a settings property, exactly as you would for hot-table.

import { createApp } from 'vue';
import { HotTable, HotColumn } from '@handsontable/vue3';
import { registerAllModules } from 'handsontable/registry';
import { createSpreadsheetData } from './helpers';

// register Handsontable's modules
registerAllModules();

const app = createApp({
  data() {
    return {
      hotSettings: {
        data: createSpreadsheetData(10, 10),
        height: 'auto',
        licenseKey: 'non-commercial-and-evaluation',
      },
      secondColumnSettings: {
        title: 'Second column header',
      },
    };
  },
  components: {
    HotTable,
    HotColumn,
  }
});

app.mount('#example1');

# Array of objects

To work with an array of objects for the hot-column component, you need to provide precise information about the data structure for the columns. To do this, refer to the data for a column in properties as data.

import { createApp } from 'vue';
import { HotTable, HotColumn } from '@handsontable/vue3';

const app = createApp({
  data() {
    return {
      hotData: [
        { id: 1, name: 'Table tennis racket', payment: { price: 13, currency: 'PLN' } },
        { id: 2, name: 'Outdoor game ball', payment: { price: 14, currency: 'USD' } },
        { id: 3, name: 'Mountain bike', payment: { price: 300, currency: 'USD' } }
      ],
      secondColumnSettings: {
        title: 'Second column header'
      },
      settings: {
        height: 'auto',
        licenseKey: 'non-commercial-and-evaluation'
      },
    };
  },
  components: {
    HotTable,
    HotColumn,
  }
});

app.mount('#example2');