Source for combobox in grid


#1

Hello.

How to specify source for combobox array of objects?

editorType: “combobox”, options: [{id:1, value:“Yes”}, {id:2, value:“No”}, {id:3, value:“Undefined”}] }

I need to set value for cells - 1, 2, 3 … and display text - Yes, No, Undefined


#2

Have you tried:

combobox.data.parse(JSON.stringify(your_array));

This works for me …


#3

I guess I said wrong :slight_smile:
I want to see “Yes, No, Undefined” in the Status column instead of 1, 2, 3

https://snippet.dhtmlx.com/27kpxfim


#4

Something like this?

https://snippet.dhtmlx.com/y68gctek


#5

Thanks. It’s better. But value is not displayed after editing

image


#6

When your database value is different from your ‘display’ value, I believe all you need to do is set the value of the input to the value of the select, in a select.onchange event handler so it will retain your ‘number’ but show the ‘text.’.

Hope this helps …


#7

Or this???

https://snippet.dhtmlx.com/hi7lrsfj


#8

It is so difficult :slight_smile:
Solution must be easy. It’s a often situation for database tables


#9

Currently, there is no native solution for the options labels in the ComboBox editor in the dhx.Grid, but we’re planning to extend that functionality in the 7.2 update.