Tópico anterior Próximo tópico Novo tópico
ASP.NET
#496563 - 26/03/2021 10:42:03 | ||||
![]() RXGOMES VALINHOS Cadast. em:Dezembro/2003 ![]() |
Bom dia pessoal
Tenho um processo que faz um update em cerca de 140.000 registro, e cliente solicitou que na página fosse colocada um barra de progresso, e estou usando o Bootstrap, o que ocorre é que a barra não é atualizada conforme os registro são atualizados. Segue o codigo, Poderiam me indicar o que estou fazendo de errado, pesquisei e fiz vários teste com base nas pesquisas mas tudo sem resultado Ah barra somente é atualiza no final dos updates Desde já agradeço a ajuda Html <div class='py-2'> <div class='progress' id='progressBar' style='height: 35px;'> <div class='progress-bar progress-bar-animated bg-success' role='progressbar' aria-valuemin='0' aria-valuemax='100' id='progress-pipe' style='width:0%; height: 35px;'></div> </div> </div> JS function ApplyDistribuition(type) {
$('#messageBox').modal('hide'); $('#wait').show(); $.ajax({ url: '/DistribuitionSafra/ApplyDistribution', data: { type: $(type).val() }, type: 'get', dataType: 'json', success: function (pipe) { alert(pipe); ProgressDistribuiton(pipe); }, error: function (e) { alert(e); } }); }; function ProgressDistribuiton(pipe) { $('#wait').hide(); $('#progressBar').css('display', 'block'); $('#progress-pipe').css('width', '0px').addClass('active'); var time; for (var i = 0; i < pipe; i++) { $('#progress-pipe').css('width', ((i + 1) / pipe * 100) + '%').addClass('active'); $('#progress-pipe').html('<span>' + (i + 1) + ' de ' + pipe + '</span>'); $('#progress_pipe').attr('aria-valuenow', (i + 1)); setTimeout(function () { }, 1000); if (i >= (pipe - 1)) { $('progress-pipe').html('<span>Distribuição finalizada</span>'); } $.ajax({ url: '/DistribuitionSafra/TreatimentPipe', data: { index: i }, type: 'get', dataType: 'json', async: false, success: function (r) { }, error: function (e) { alert(i); } }); } |
|||
#496576 - 27/03/2021 12:37:32 | ||||
![]() RXGOMES VALINHOS Cadast. em:Dezembro/2003 ![]() |
Pessoal depois de muitas tentativas consegui alterando a função ProgressDistribuiton conforme abaixo
async function ProgressDistribuiton(pipe) {
$('#wait').hide(); $('#progressBar').css('display', 'block'); $('#progress-pipe').css('width', '0%').addClass('active'); var time; for (var i = 0; i < pipe; i++) { $('#progress-pipe').css('width', ((i + 1) / pipe * 100) + '%').attr('aria-valuenow', (i + 1)); $('#progress-pipe').html('<span>' + (i + 1) + ' de ' + pipe + '</span>'); await $.ajax({ url: '/DistribuitionSafra/TreatimentPipe', data: { index: i }, type: 'get', dataType: 'json', async: false, success: function (r) { }, error: function (e) { alert(i); } }); } |
|||
Tópico anterior Próximo tópico Novo tópico