How to get handson table data as key value pairs json on click of a button

Tags: #<Tag:0x00007efc6e3537b8>

Hi @aleksandra_budnik ,

I need to get handson table data as key value pairs as json data on click of a button.

Hi @sumanthhs48

Maybe this demo will help https://jsfiddle.net/handsoncode/f0b41jug/. It uses custom cell validator, editor and renderer for the key-value dropdown.

Hi @aleksandra_budnik

I need complete table data as json key value pair on click

So you keep the table data as an array of objects and then you want to retrieve the table data (as I understand the altered data). I am right?

If so here are related topics
https://handsontable.com/docs/api/core/#getdata
https://handsontable.com/docs/api/core/#getsourcedata

Hi @aleksandra_budnik
yes but i need json data not array

Does this https://jsfiddle.net/f5vcoyzj/1/ work for you?

Actually getSourceData() function shows undefined

Does my demo return undefined for you?

It returns data for me (on Chrome 99)

00

Hi @aleksandra_budnik

Handson table version 0.16.0 it happens here when data is added in this format

const data = [
  ['', 'Tesla', 'Nissan', 'Toyota', 'Honda', 'Mazda', 'Ford'],
  ['2017', 10, 11, 12, 13, 15, 16],
  ['2018', 10, 11, 12, 13, 15, 16],
  ['2019', 10, 11, 12, 13, 15, 16],
  ['2020', 10, 11, 12, 13, 15, 16],
  ['2021', 10, 11, 12, 13, 15, 16]
];

The getSourceData was not available in version 0.16. If you update to a newer version the issue is gone.

Actually newer version does not support select 2 renderer

Select 2 is not an official Handsontable project and we do not support it.

Hi @aleksandra_budnik
is there any alternative for select 2

Handsontable does not support this functionality yet. If there is an alternative, it is also a 3rd party project.

Hi @aleksandra_budnik
Can we get value with handsontable dropdown.

Can we get value with handsontable dropdown.

Do you mean how to get the value that was chosen by the user upon change?

hi @aleksandra_budnik
<option value="id">Name</option>
value from option

Sorry, we do not have any demos other than https://jsfiddle.net/handsoncode/f0b41jug/ for the dropdown key-value subject.

Hi @aleksandra_budnik
Thank you