adl/resources/js/select-widget-support.js
Simon Brooke 83f23dd055 Work on asynchronous select widget loading.
Not working yet, but significant progress.
2018-07-04 19:01:18 +01:00

15 lines
539 B
JavaScript

/**
* update the select menu with id `wid` from this `data` whose fields include
* this `entity_key` and these `fields`
*/
function updateMenuOptions(wid, entity_key, fields, data){
$('#' + wid).children().filter(function(){
return $(this).attr('selected') === undefined;
}).remove().end();
$.each(data, function(key, entry){
$('#' + wid).append(
$('<option></option>').attr('value', key).text(entry));
});
}