Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

180
Vistas
Loop is not working in this switch case jquery

Loop is not initiating in this code and also split_value doesn't store any value. I want to compare dropdown value and excel data and then matched value should store in sum = [].

if (items) {
  switch (currentControl) {
    case "Record_Code":
      var dropdownvalue1 = $.map($('#ddlOrderSourceEligibilityGoaloption'), function(ele) {
        return {
          text: ele.text,
          value: ele.value
        }

        for (var v = 0; v < myitem.length; v++) {
          isFound = 0;

          for (i = 0; i < dropdownvalue1.length; i++) {
            var split_value = dropdownvalue1[i].text.split('-');

            if ((myitem[v].split('-')[0]).trim() == (split_value[0]).trim()) {
              sum.push(dropdownvalue1[i].value);
              isFound = 1;
              break;
            }
          }

          if (isFound == 0) {
            NotFound.push(myitem[v]);
          }
        }

        if (sum.length > 0) {
          setMultiSelectValue("#ddlOrderSourceEligibilityGoal", sum);
          $(".uploadExcelTE").val('');
        }
      });
      break;

    case "Order_Source":
      break;

    case "Order_Type":
      break;

    case "Bill_To_Cust":
      break;

    case "Item_Status":
      break;
  }
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The problem is that you use a return statement in the first block of the switch-case statement. If currentControl is "Record_Code", the program always assigns dropdownvalue1 the value {text: ele.text, value: ele.value}.

if (items) 
{
  switch (currentControl) 
  {
    case "Record_Code":
      var dropdownvalue1 = $.map($('#element'), function (ele) {
        // The dropdownvalue1 variable is always assigned the following result.
        return { text: ele.text, value: ele.value }
                
        // The code blocks below never work.
        for(var v = 0; v < myitem.length ; v++){}
      });
      break;
  }
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda