Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 5d599617

Přidáno uživatelem Jakub Vašta před asi 4 roky(ů)

Re #8080
+ data set type select box change - options are disabled not removed

Zobrazit rozdíly:

website/public/js/zcu-heatmap.js
222 222

  
223 223
function updateAvailableDataSets(available) {
224 224
  
225
  var options = '';
226

  
227
  Object.entries(available).forEach(([key, value]) => {
228
    options += '<option value="' + value + '">' + key + '</option>\n'; 
225
  var isOptionEnabled = true;
226
  $("#type > option").each(function() {
227
    if((this.value in available) == false) {
228
      $(this).prop('disabled', true)
229
      $(this).prop('selected', false)  
230
    }
231
    else {
232
      $(this).prop('disabled', false)
233
      if (isOptionEnabled) {
234
        $(this).prop('selected', true)
235
      } 
236
      isOptionEnabled = false;
237
    }
229 238
  });
230 239

  
231
  if (options === '') {
232
    $('#submit-btn').prop('disabled', true);
233
  }
234
  else {
235
    $('#submit-btn').prop('disabled', false);
236
  }
240
  $('#submit-btn').prop('disabled', isOptionEnabled);
237 241

  
238
  $('#type').empty().append(options);
239
  
240 242
}

Také k dispozici: Unified diff