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

90
Visualizações
Selectize.js take a long time to create structure

I have a problem with Selectize.js, where it is taking a long time to create the structure, I make a request in my backend where it returns about 1000 data, which does not take 500ms of response, but when adding the options in my Selectize.js using addOption and addItem takes more than 10 seconds. Is there a way to improve this or a faster alternative?

Javascript:

$('#my-select').selectize({
    sortField: 'text'
});

//initialize request
var request = $.ajax({
    url: "/request_data.php",
    type: "post",
    dataType: 'json',
});

// Callback handler that will be called on success
request.done(function (response, textStatus, jqXHR) {
    response.forEach(function (data) {
        ///////////////////////////////////HERE TAKE A LONG TIME
        form_field_select[0].selectize.addOption({ value: data.id, text: data.text });
        form_field_select[0].selectize.addItem(data.id);
    });
});

HTML

<select id="my-select">
    <option value="">Select any option</option>
</select>
about 4 years ago · Juan Pablo Isaza
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