Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
123
rated 0 times [  126] [ 3]  / answers: 1 / hits: 19603  / 13 Years ago, tue, june 21, 2011, 12:00:00

i am trying to change the values of the progress bar widget to accept a json string i am getting which is something like:



{
'totalDays' : 31,
'daysTaken' : 20
}


so i want the 'totalDays' to be the total value of the progress bar (total length) and the 'daysTaken' to fill the progress bar.



according to the default docs, only the filled value is possible to change:



$(document).ready(function() {
$(#progressbar).progressbar({ value: 37 });
});

More From » jquery

 Answers
30

There is a separate method to set the value after init.



var obj = {totalDays: 31, daysTaken: 20};
$(#progressbar).progressbar('value', obj.daysTaken/obj.totalDays * 100);


There is no configurable max value, but it's really not necessary since it is easy normalize values.



http://jqueryui.com/demos/progressbar/


[#91602] Monday, June 20, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sabinal

Total Points: 144
Total Questions: 112
Total Answers: 107

Location: Ghana
Member since Mon, Aug 22, 2022
2 Years ago
;