UI Widgets ProgressBar

A widget used to indicate progress.

Included in: dx.phonejs.js, dx.webappjs.js, dx.all.js

You can create a widget using one of the following approaches.

  • jQuery
    Use the dxProgressBar jQuery plug-in.

    HTML
    <div id="progressBar"></div>
    JavaScript
    $("#progressBar").dxProgressBar({
        min: 0,
        max: 1000,
        showStatus: true,
        statusFormat: function(ratio, value) {
            return ratio * 100 + "% (" + value + ")";
        }
    });
  • Knockout
    Add a div element and apply the dxProgressBar binding to this element.

    HTML
    <div data-bind="dxProgressBar: {
        min: 0,
        max: 1000,
        showStatus: true,
        statusFormat: function(ratio, value) {
            return ratio * 100 + "% (" + value + ")";
        }
    }"></div>
  • Angular
    Add a div element and apply the dx-progress-bar directive to this element.

    HTML
    <div dx-progress-bar="{
        min: 0,
        max: 1000,
        showStatus: true,
        statusFormat: function(ratio, value) {
            return ratio * 100 + "% (" + value + ")";
        }
    }"></div>

Note that DevExtreme widgets require you to link the jQuery and Globalize libraries to your application. If you use the Knockout or Angular approach, the Knockout or Angular library is also required.

See Also

You can find detailed information on the principles of working with the widget in the dxProgressBar section of the Editor Widgets article.

View Demo

Show Example:
AngularJS
Knockout
jQuery
<div ng-controller="demoController">
    <div class="button" dx-button="{
        onClick: updateProgress,
        bindingOptions: {
            text: 'buttonText'
        }
    }"></div>
    <div class="progress-bar" dx-progress-bar="{ 
        min: 0,
        max: 10,
        bindingOptions: {
            value: 'clickCount'
        }
    }"></div>
</div>
var myApp = angular.module('myApp', ['dx']);
myApp.controller("demoController", function ($scope) {
    $scope.clickCount = 0;
    $scope.buttonText = 'Perform a step';
    $scope.updateProgress = function () {
        if ($scope.buttonText === "Reset progress") {
            $scope.clickCount = 0;
            $scope.buttonText = "Perform a step";
            return;
        }
        $scope.clickCount++;
        if ($scope.clickCount === 10)
            $scope.buttonText = "Reset progress";
    };
});
angular.element(document).ready(function () {
    angular.bootstrap(document, ['myApp']);
});
body {
    text-align: center;
}
.button{
    margin-top: 25px;
}
.progress-bar{
    margin: 10px;
}
<div class="button" data-bind="dxButton:{ text: buttonText, onClick: updateProgress }"></div>
<div class="progress-bar" data-bind="dxProgressBar:{ min: 0, max: 10, value: clickCount }"></div>
var myViewModel = {
    clickCount: ko.observable(0),
    buttonText: ko.observable('Perform a step'),
    updateProgress: function () {
        if (this.buttonText() === "Reset progress") {
            this.clickCount(0);
            this.buttonText("Perform a step");
            return;
        }
        this.clickCount(this.clickCount() + 1);
        if(this.clickCount() === 10)
            this.buttonText("Reset progress");
    }
}
ko.applyBindings(myViewModel);
body {
    text-align: center;
}
.button{
    margin-top: 25px;
}
.progress-bar{
    margin: 10px;
}
<div class="button" id="increaseProgressButton"></div>
<div class="progress-bar" id="myProgressBar"></div>
var clickCount = 0;
$("#myProgressBar").dxProgressBar({
    min: 0,
    max: 10,
    value: 0
});
$("#increaseProgressButton").dxButton({
    text: 'Perform a step',
    onClick: function () {
        if ($("#increaseProgressButton").dxButton("instance").option("text") === "Reset progress") {
            clickCount = 0;
            $("#myProgressBar").dxProgressBar("instance").option("value", clickCount);
            $("#increaseProgressButton").dxButton("instance").option("text", "Perform a step")
            return;
        }
        clickCount++;
        $("#myProgressBar").dxProgressBar("instance").option("value", clickCount);
        if(clickCount === 10)
            $("#increaseProgressButton").dxButton("instance").option("text", "Reset progress")
    }
});
body {
    text-align: center;
}
.button{
    margin-top: 25px;
}
.progress-bar{
    margin: 10px;
}

Configuration

An object defining configuration options for the dxProgressBar widget.

Methods

This section describes the members used to manipulate the widget.

Events

This section describes events exposed by this widget.