Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

320
Visualizações
Populated sumo select is not refreshing

I am using Sumo Select plugin for my application and the reload is not working. I have 2 dropdowns.

dp1, dp2

I am pulling a set of list for dp1 and when it is selected the dp2 will be sorted as per db1 results. for this i need to have dp2 reloaded. The code is below.

$("#dp1").change(function(e){
    e.preventDefault();
    var id = document.getElementById("dp1").value;
    $.ajax({
        url:'try_out.php',
        method: 'POST',
        dataType: 'json',
        data: {id:id},
        success:function(data){
            $.each(data.line_items, function(i, item_list) {
                $('#dp2')[0].sumo.add(item_list.description);
            });
            //WHERE IT HAS TO BE RELOADED - DOESN'T WORK
            $('#dp2')[0].sumo.reload();
        },
        failure: function (data) {
            console.log('AUL');
        }
    });
});

Where am I making the mistake! Cheers.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This costed a lot. Finally found out that removing HTML select data first and then reloading the dropdown will make the dropdown fresh.

$('#dp2').html('');
$('#dp2')[0].sumo.reload();

The Answer:

$("#dp1").change(function(e){
    $('#dp2').html('');
    $('#dp2')[0].sumo.reload();
    e.preventDefault();
    var id = document.getElementById("dp1").value;
    $.ajax({
        url:'try_out.php',
        method: 'POST',
        dataType: 'json',
        data: {id:id},
        success:function(data){
            $.each(data.line_items, function(i, item_list) {
                $('#dp2')[0].sumo.add(item_list.description);
            });
            //WHERE IT HAS TO BE RELOADED - DOESN'T WORK
            $('#dp2')[0].sumo.reload();
        },
        failure: function (data) {
            console.log('AUL');
        }
    });
});
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda