Categories | Question details Back To List | ||
Combo options include existing value Here's how I add values to the drop-down: var combo = grid.getCombo(3); combo.clear(); combo.put(0, "View Busy/Free Time"); combo.put(1, "View Events"); combo.put(3, "View and Edit Events"); That works ok, the values are added and can be selected and the correct value sent. However, when the grid is loaded, the value put into the cell itself is just the text representation of the value (ie, 'View Events') and that value is added into the select drop down. This is a problem for two reasons: 1) The 'View Events' option appears twice, 2) Selecting the 'View Events' that was added from the cell value by dhtmlx causes the value 'View Events' to be sent back to the server which is not correct. Answer posted by dhxSupport on Dec 14, 2009 06:31 >>However, when the grid is loaded, the value put into the cell itself is just the text representation of the value (ie, 'View Events') and that value is added into the select drop down. In xml you should put combo value not combo text. Otherwise 'View Events' will appear twice. Answer posted by mtyson on Dec 14, 2009 06:45 Answer posted by mtyson on Dec 14, 2009 06:48 Thanks for the reply, but that solution is problematic. I want the label text to display 'View Events' and not the value 1, because naturally, that's what makes sense to an end user. So how can I display the label but have the value in there to prevent the duplicate? Please note I am using JSON. Answer posted on Dec 14, 2009 07:34 First you should put combo.put(0, "View Busy/Free Time"); combo.put(1, "View Events"); combo.put(3, "View and Edit Events"); before grid.init() Second you should pass options values into xml instead of option labels. After grid is loaded it will replace values with correct labels. It will also works for JSON as well as for XML. |