Okay I’ve tried, but cannot get it to work. I’m trying to load “Array of Object” data from a data file and it’s not working.
I’m using the code from the example in your guide (see link at the end) as shown below:
Handsontable.dom.addEvent(load, ‘click’, () => {
ajax(‘data/json/load.json’, ‘GET’, ‘’, res => {
const data = JSON.parse(res.response);
hot.loadData(data);
exampleConsole.innerText = ‘Data loaded’;
});
});
The only difference is instead of the “load.json” file containing an “Array of Array”, I am using an “Array of Objects” and it’s not working.
To be specific, instead of using “Array of Array” like below:
[
[ “”, “Tesla”, “Volvo”, “Toyota”, “Ford” ],
[ “2019”, 10, 11, 12, 13 ],
[ “2020”, 20, 11, 14, 13 ],
[ “2021”, 30, 15, 12, 13 ]
]
I’m using “Array of Objects” as below and it’s not working:
[
{ id: 1, name: ‘Ted Right’, address: ‘address’ },
{ id: 2, name: ‘Frank Honest’, address: ‘’ },
{ id: 3, name: ‘Joan Well’, address: ‘’ },
{ id: 4, name: ‘Gail Polite’, address: ‘’ },
{ id: 5, name: ‘Michael Fair’, address: ‘’}
]
Link to your example I’m referencing:
https://handsontable.com/docs/saving-data/#overview