[GH #2305] Dropdown key value

Tags: #<Tag:0x00007efc6989fe60> #<Tag:0x00007efc6989fd20>

Hi @dev3

that is true… we do not have any official solution yet.

However, some time ago one of our developers was testing his code and created a similar functionality that may come in handy. Here it is https://jsfiddle.net/handsoncode/f0b41jug/

Hi @aleksandra_budnik,

I’m part of the team that uses Handsontable and we’d need Dropdown with key-value support. It’s quite crucial for us to have it, since we are at the beginning of a project where this will be needed. We’ll also need to support having Dropdowns in multiple columns with dependencies between them (but that’s already another story).

Are there any (good) news from your side?

Thx and have a nice day!

Hi @andraz.podobnik

key-value dropdown is not available out of the box (that would require some custom work on the editor/renderer and validator). But when it comes to cell dependencies we have some useful demos and a tutorial on the blog at https://handsontable.com/blog/articles/2016/4/expand-your-app-with-cell-dependencies

We also opened up consulting services as an extension to the normal support plan. That is a good option if you want to make everything work fast while using the recommended official API and good coding practices.

That is quite old issue we are texting in. Please feel free to send me an email at support@handsontable.com to discuss the details.

Hello @aleksandra_budnik,

I am part of a small dev team having a project using Handsontable. One of the critical functions we need is having a dropdown cell with the capability to handle/use a key-value pair as source data. Any good news regarding this dropdown key-value issue?

Thanks and best regards!

Hi @pippo.tantan

Can you send me a message to support@handsontable.com with the requirements of your project? I might have some valuable tips regarding the key-value option.

Hi @aleksandra_budnik,

The link you sent, helped me resolve the problem with the key-value option. Thank you. :slight_smile:

That’s great, @pippo.tantan! Thank you for the info.

1 Like

And this secret link was…

I see a lot of threads talking about the same, also including samples, but all based on old versions of Handsontable that are not working today.

We are seriously considering buying a license, but this missing feature with a select or dropdown was breaking all previous work to complete the full test.

Hi @francesc.pineda The general idea for a dropdown key-value cell that runs on the latest version of Handsontable can be found here https://jsfiddle.net/handsoncode/f0b41jug/. You just need to know that there are no tests for this use case so extending it further can lead to unexpected behavior.

@aleksandra_budnik Any idea when this feature will reach production use?

The only issue I’m having with that sample code is when you go to double click on the value to change it, the preview shows the ID instead of the name. I’m not familiar enough with your API to figure this out myself at this point. But if you have any pointers on how to fix this, I’d appreciate it!

hi @tctech

In the demo above, I see the value in the renderer and editor

Renderer
27

Editor
21

 source: [
    {_id: 1, label: 'Mike'},
    {_id: 2, label: 'Roman'},
    {_id: 3, label: 'Juan'},
  ] 

In which case do you see id?

@aleksandra_budnik

If you change the value of the cell to Mike, lose focus on that cell, and then double click on Mike again, it shows the ID 1 instead of Mike

Hi @tctech

This is not an official version of the key-value dropdown, and if there are any issues related to the use of it I can only recommend checking the cell editor guide https://handsontable.com/docs/cell-editor/#overview. The first thing that comes to my mind is some issue within the getValue()/setValue() methods.

@tctech I just realized the error you are making. You solve it by adding change line 41 with the following statement. Thanks @aleksandra_budnik give me some suggestions

     const index = this.htEditor.getDataAtProp('_id').findIndex(id => id === Number(value));
2 Likes

We are considering purchasing a license, but a dropdown with key value is a must. Has there been any movement on this?

Hi @jose.lionel.velez

Have you seen this idea https://jsfiddle.net/handsoncode/f0b41jug/? (it is linked above)

We are able to show values

37

but operate on IDs

source: [
  	{_id: 1, label: 'Mike'},
    {_id: 2, label: 'Roman'},
    {_id: 3, label: 'Juan'},
  ]

Thanks,

I will take a look, but what is your plan to offer baked in support for this?

I am not comfortable with considering making the investment in using HOT while relying on hacks/workarounds when this should be included in a production release.

Folks have been asking for this for years and it concerns me that no action has been taken.

I can relate to that. The dropdown key-value functionality is on our list of features to be added, but it’s not the highest priority. And features take time. For instance, we are currently working on themes. I will surely mention that the topic of the dropdown key-value cell type was brought up again (hopefully, that will raise its priority).

Regarding the shared solution, it was created by our main developer with all the knowledge he had, and without using any internal helpers (which may be removed one day). However, I imagine that a cell type is more reliable, so I would never force anyone to purchase a license based on a solution that is not native.

Thanks for the response. In my opinion, this is much more important than themes. I will have to choose a different tool instead of HOT because of this. I highly recommend you ask your team to get this addressed. This is not a nice to have, it is a must have. Themes are a nice to have.

Hi @jose.lionel.velez

I did what was in my power to update and team and rise the priority.

Hopefully that will trigger the process but I cannot guarantee anything at this point. As I would like to give some possible dates but it is too soon for it. At the same time I fully understand the decide not to go with the custom code solution we made.