Could it be possible to have an extra optional parameter for application.setValueListItems() that says if the valuelist must be sorted on displayvalue (boolean, default false)
So like this:
Syntax
application.setValueListItems(name,displayValArray/dataset,[realValuesArray],[autoconvert(false)], [sortOnDisplayValues(false)])
The reason for this request is, that I have a lot of displayvalues that are unstored calculations in my foundset, because the displayvalue must be shown in the correct language.
And sorting on unstored calculations in a foundset is not possible (if that was possible, then it would solve my problem also)
Now I create 2 arrays, one with ID-fields and one with DISPLAY-fields
Javascript can sort arrays, but the two arrays must remain in sync.
- Code: Select all
_fs.loadAllRecords();
_fs.sort('description asc'); // Unfortunately this doesn't work because description is unstored calculation field
//Returns a foundset dataprovider (normally a column) as JavaScript array
var _id_array = databaseManager.getFoundSetDataProviderAsArray(_fs, 'country_id');
var _desc_array = databaseManager.getFoundSetDataProviderAsArray(_fs, 'description');
application.setValueListItems( 'countryname', _desc_array, _id_array);
So it would be great if the application.setValueListItems() can have an option that it must be sorted on displayvalue (unless sorting on unstored calculations will be supported)
Or is there a simple way that this foundset can be converted to a dataset and that the sort can take place on the dataset?
But if that is easy, then the extra parameter will be easy as well I guess