Your search did not match any results.

Progress Bar


This demo shows how to configure the ProgressBar component.

To create a ProgressBar, declare it in markup. You can specify the following properties to change the ProgressBar's numeric scale:

  • min and max
    The min and max properties limit the range of accepted values.

  • value
    This property specifies the current value. If you want to switch the ProgressBar to an indeterminate state, set the value property to false.

This demo uses the custom timer function to increase the ProgressBar's value.

When the ProgressBar reaches the maximum value, the complete event occurs. Use the onComplete function to handle it.

The progress status displays a ratio between the current and maximum values and indicates the progress. Use the showStatus property to display or hide the status string. To format the status string, use the statusFormat function.

Backend API
<div class="form"> @(Html.DevExtreme().Button() .ID("progress-button") .Text("Start progress") .Width(200) .OnClick("button_onClick") ) <div class="progress-info"> Time left 00:00:<span id="timer">10</span> </div> <div id="progress"> @(Html.DevExtreme().ProgressBar() .ID("progressBarStatus") .Min(0) .Max(100) .Width("90%") .StatusFormat(new JS("progressBar_statusFormat")) .OnComplete("progressBar_onComplete") ) </div> </div> <script> var seconds = 10, inProgress = false; window.intervalId = window.intervalId || null; function timer() { seconds--; setCurrentStatus(); if(seconds === 0) { clearInterval(intervalId); seconds = 10; return; } } function setCurrentStatus() { $("#progressBarStatus").dxProgressBar("option", "value", (10 - seconds) * 10); $("#timer").text(("0" + seconds).slice(-2)); } function progressBar_statusFormat(value) { return "Loading: " + value * 100 + "%"; }; function progressBar_onComplete(e) { inProgress = false; $("#progress-button").dxButton("option", "text", "Restart progress"); e.element.addClass("complete"); }; function button_onClick(e) { clearInterval(intervalId); $("#progressBarStatus").removeClass("complete"); if(inProgress) { e.component.option("text", "Continue progress"); clearInterval(intervalId); } else { e.component.option("text", "Stop progress"); setCurrentStatus(); intervalId = setInterval(timer, 1000); } inProgress = !inProgress; } </script>
using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; namespace DevExtreme.NETCore.Demos.Controllers { public class ProgressBarController : Controller { public ActionResult Overview() { return View(); } } }
.form { padding: 20% 0; text-align: center; } #progress-button{ margin-bottom: 20px; } #progressBarStatus { display: inline-block; } .complete .dx-progressbar-range { background-color: green; }