From cf60932ed02cc5dc263dac893158482674e0a130 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Thu, 25 Jan 2024 01:05:00 +0100 Subject: [PATCH] improve service selection dropdown behavior --- htdocs/lib/MetaPanel.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/lib/MetaPanel.js b/htdocs/lib/MetaPanel.js index 8cd2378c..68729cd9 100644 --- a/htdocs/lib/MetaPanel.js +++ b/htdocs/lib/MetaPanel.js @@ -552,11 +552,13 @@ WfmMetaPanel.prototype.clear = function() { function DabMetaPanel(el) { MetaPanel.call(this, el); + var me = this; this.modes = ['DAB']; + this.service_id = 0; this.$select = $(''); this.$select.on("change", function() { - var service_id = parseInt($(this).val()); - $('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator().setDabServiceId(service_id); + me.service_id = parseInt($(this).val()); + $('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator().setDabServiceId(me.service_id); }); var $container = $( '
' + @@ -582,15 +584,16 @@ DabMetaPanel.prototype.update = function(data) { var options = Object.entries(data.programmes).map(function(e) { return ''; }); - $(this.el).find('#dab-service-id').html( - '' + + this.$select.html( options.join('') ); + this.$select.val(this.service_id); } } DabMetaPanel.prototype.clear = function() { - + this.service_id = 0; + this.$select.empty(); } MetaPanel.types = {