This is a migrated thread and some comments may be shown as answers.

ProgressBar with type=percent round 99.99 to 100%

3 Answers 828 Views
ProgressBar
This is a migrated thread and some comments may be shown as answers.
Konstantin
Top achievements
Rank 1
Konstantin asked on 20 Sep 2018, 08:54 AM

Hi,ProgressBar with type="percent" round 99.99 to 100%, need math.floor to 99% or 99.99%

https://dojo.telerik.com/OqeqAkOV/2

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 21 Sep 2018, 01:11 PM
Hi Konstantin,

You can use Math.floor if you need to, e.g.,:
$('#PercentValue').kendoProgressBar({
    value: Math.floor(model.CompletionPercent),
    type: 'percent',
    min: 0,
    max: 100,
    animation: false
});
however by default the ProgressBar does not display decimal numbers when its type is set to "percent". With this type set if you try to pass a decimal number as value it will be rounded up or down depending on the value: e.g., 99.4 is rounded down and displayed 99%, while 99,5 is rounded up and displayed 100%.

You can log the ability to display fractional percent as a feature request in our Feedback Portal. It will be evaluated by the team and if approved will be implemented in a subsequent release.

Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Konstantin
Top achievements
Rank 1
answered on 24 Sep 2018, 03:46 AM

Hello, Ivan.

It's not complite solution. It's help only for grid. I'm use EditorTemplates for edit:

@(Html.Kendo().ProgressBar()
    .Name(ViewData.TemplateInfo.GetFullHtmlFieldName(""))
    .Type(ProgressBarType.Percent)
    .HtmlAttributes(new { style = "width:100%", data_bind="value:" + ViewData.TemplateInfo.GetFullHtmlFieldName("") }))

0
Ivan Danchev
Telerik team
answered on 26 Sep 2018, 06:05 AM
Hello Konstantin,

Indeed the suggested workaround would not be applicable to all scenarios. That is why I suggest logging a feature request. Implementing it would allow fractional percent to be properly used by the widget.

Regards,
Ivan Danchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ProgressBar
Asked by
Konstantin
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Konstantin
Top achievements
Rank 1
Share this question
or