How to change the source of a dropdown cell type based on another chosen value (cell dependencies)
by handsoncode
HTML
<script src="https://cdn.jsdelivr.net/npm/handsontable@14.5/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@14.5/dist/handsontable.full.min.css" />
<script src="https://cdn.jsdelivr.net/npm/react@17/umd/react.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/react-dom@17/umd/react-dom.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@handsontable/react@14.5/dist/react-handsontable.min.js"></script>
<script src="https://handsontable.com/docs/scripts/fixer.js"></script>
<div id="example"></div>
Babel + JSX
import React, {useRef} from "react";
import ReactDOM from "react-dom";
import Handsontable from "handsontable/base";
import { HotTable } from "@handsontable/react";
import "handsontable/dist/handsontable.full.min.css";
export const ExampleComponent = () => {
const hotTableComponentRef = useRef(null);
const data = [
{
car: "Mercedes A 160",
year: '2020',
ownersByYear: {2020: 'Micheal Pattinson', 2021: 'John Smith', 2022: 'James Anthon'},
owner: 'John Smith',
cleared: false
},
{
car: "Citroen C4 Coupe",
year: '2021',
ownersByYear: {2020: 'Micheal Pattinson', 2021: 'John Smith', 2022: 'James Anthon'},
owner: 'James Anthon',
cleared: false
},
{
car: "Audi A4 Avant",
year: '2022',
ownersByYear: {2020: 'Andrew Sanchez', 2021: 'John Smith', 2022: 'James Anthon'},
owner: 'James Anthon',
cleared: true
},
{
car: "Opel Astra",
year: '2021',
ownersByYear: {2020: 'John Smith', 2021: 'Micheal Pattinson', 2022: 'Andrew Sanchez'},
owner: 'John Smith',
cleared: false
},
{
car: "BMW 320i Coupe",
year: '2020',
ownersByYear: {2020: 'Andrew Sanchez', 2021: 'John Smith', 2022: 'Micheal Pattinson'},
owner: 'Andrew Sanchez',
cleared: true
},
{
car: "Skoda Octavia",
year: '2022',
ownersByYear: {2020: 'Andrew Sanchez', 2021: 'John Smith', 2022: 'Micheal Pattinson'},
owner: 'Micheal Pattinson',
cleared: true
},
{
car: "Hyundai Coupe",
year: '2022',
ownersByYear: {2020: 'Andrew Sanchez', 2021: 'John Smith', 2022: 'Micheal Pattinson'},
owner: 'Micheal Pattinson',
cleared: true
},
{
car: "Peugeot 407",
year: '2021',
ownersByYear: {2020: 'Andrew Sanchez', 2021: 'John Smith', 2022: 'Micheal Pattinson'},
owner: 'John Smith',
cleared: false
},
{
car: "BMW Z3",
year:...