Servoy 5.0.1
We use combobox fields as drop-down selection lists. Each combobox has a unique dataprovider and a unique custom valuelist associated with it. Both the dataprovider and custom valuelist are loaded programmatically. For example, here is the (abbreviated) code for loading a list of vendor names:
var dataset = databaseManager.getDataSetByQuery()
var arrayVendorNames = dataset.getColumnAsArray( 1 )
application.setValueListItems( 'vendorlist', arrayVendorNames )
globals.vendorname = 'Select a Vendor'
This produces a combobox as follows:
±-------------------+
| Select a Vendor / |
±-------------------+
| ABC |
| DEF |
| GHI |
| JKL |
±-------------------+
When the ‘Select a Vendor’ combobox is clicked, a list of vendor names drops down. Selecting a vendor name from the drop-down list replaces the ‘Select a Vendor’ with the vendor name, which is also returned in the dataprovider (globals.vendorname). This scenario works fine.
We run into trouble when we have a valuelist that contains a display value and a return value. The (abbreviated) code for that is as follows:
var dataset = databaseManager.getDataSetByQuery()
var arrayVendorNames = dataset.getColumnAsArray( 1 )
var arrayVendorNumber = dataset.getColumnAsArray( 2 )
application.setValueListItems( 'vendorlist', arrayVendorNames, arrayVendorNumber )
globals.vendorname = 'Select a Vendor'
This produces a combobox as follows (NOTE: the dataprovider value is not showing):
±-------------------+
| / |
±-------------------+
| ABC |
| DEF |
| GHI |
| JKL |
±-------------------+
Why is the dataprovider (default) value not being displayed on the combobox when a return value is attached to the drop-down list? Is this a bug? Workarounds?
Thanks!