[GH #2305] Dropdown key value

Tags: #<Tag:0x00007fbe87c5ec28> #<Tag:0x00007fbe87c5eae8>

Hello,

May I ask a question about this

There was a response as following.
“It’s on our TOP 5 needed features.”

It’s almost a year, is it still working on or it has been dropped?

Thanks!

Xin

1 Like

Welcome @chenxin

I am sorry but there are no new updates on that topic. Now, we’re working on np 1 - the performance https://github.com/handsontable/handsontable/issues/5769

You can track this topic https://github.com/handsontable/handsontable/issues/2305 for updates

Hey, there!
This one is a little bit tricky.
Create a new global array to store your key-value pair, for example:

var arrSource = [{id: 1, value: "John"}, {id: 2, value: "Smith"}, {id: 3, value: "Peter"}];

Change your ddSource to store only value. After that, in afterChange, I do looping to change the value to its id, like this:

var newValue= change[0][3];
for (var i in arrSource) {
    if (newValue === arrSource[i]["value"]) {
        newValue = arrSource[i]["id"];
    }
}

That’s all from me, not the best approach though but I hope it could helps you. :v:

1 Like

Wooow, thanks moel! This really helped me out! It’s pretty strange there is no key/value dropdown in HOT but oh well. Appreciated, have a nice day!

https://github.com/kpi-intelligence/handsontable-key-value

thought about including this into HOT?

Hi @dan

We try to rely on the least amount of external dependencies as possible.
So we don’t plan to add this plugin.

Maybe in the future, we will try to write ourselves something similar.
It depends on the direction in which we should develop Handsontable.