Basaingeal / Razor.SweetAlert2

A Razor class library for interacting with SweetAlert2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can you please provide documentation on how to implement Progress?

ITninja04 opened this issue · comments

Love what you've done so far, and this is working brilliantly in one of our apps.

We'd like to use the Progress feature but cannot figure out how it's supposed to be implemented.

Can you please provide some clarification around this?

Let me get back to you on that. I was trying to mock up an example, but it seems like QueueAsync() might be having some issues I need to resolve. It looks like it isn't passing in the options like it used to and you just get blank SweetAlerts. Perhaps that's what you've been running into, because the Progress feature shouldn't behave any differently than in the JavaScript library.

I've published a new version to Nuget that resolves to empty queue swals issue. Will be available in a few minutes here.
Meanwhile, here is my implementation of progress that mirrors the JS documentation:

async Task ChainingModals()
  {
    SweetAlertQueueResult result = await Swal.Mixin(new SweetAlertOptions
    {
      Input = SweetAlertInputType.Text,
      ConfirmButtonText = "Next →",
      ShowCancelButton = true,
      ProgressSteps = new string[3] { "1", "2", "3" },
    }).QueueAsync(new SweetAlertOptions[3] {
      new SweetAlertOptions
      {
      Title = "Question 1",
      Text = "Chaining swal2 modals is easy",
      },
      new SweetAlertOptions("Question 2"),
      new SweetAlertOptions("Question 3")
      });
    if (result.Value != null && result.Value.Any())
    {
      await Swal.FireAsync(new SweetAlertOptions
      {
        Title = "All done!",
        Html = $"Your answers: <pre><code>{JsonSerializer.ToString(result.Value)}</code></pre>",
        ConfirmButtonText = "Lovely!"
      });
    }
  }

Please let me know how this works for you and if you would like anything further. Thank you.

Rock on man! That helps out a ton, and yes I was getting blank screens for each progress step.

I really appreciate your work on this!!

Thank you! Glad to hear it's getting some good use.