*
*
* @constructor
- * Create a new Progress
+ * Create a new ProgressBar
* @param {Object} config The config object
*/
-Roo.bootstrap.Progress = function(config){
- Roo.bootstrap.Progress.superclass.constructor.call(this, config);
+Roo.bootstrap.ProgressBar = function(config){
+ Roo.bootstrap.ProgressBar.superclass.constructor.call(this, config);
};
-Roo.extend(Roo.bootstrap.Progress, Roo.bootstrap.Component, {
+Roo.extend(Roo.bootstrap.ProgressBar, Roo.bootstrap.Component, {
- aria_valuenow : false,
+ aria_valuenow : 0,
aria_valuemin : 0,
aria_valuemax : 100,
label : false,
role : false,
sr_only: false,
- getAutoCreate : function(){
+ getAutoCreate : function()
+ {
+
var cfg = {
tag: 'div',
- cls: 'progress',
- cn: [
- {
- tag: 'div',
- cls: 'progress-bar'
- }
- ]
+ cls: 'progress-bar',
+ style: 'width:' + Math.ceil((this.aria_valuenow / this.aria_valuemax) * 100) + '%'
};
if(this.sr_only){
- cfg.cn[0].cn = {
+ cfg.cn = {
tag: 'span',
cls: 'sr-only',
html: this.sr_only
}
if(this.role){
- cfg.cn[0].role = this.role;
+ cfg.role = this.role;
}
if(this.aria_valuenow){
- cfg.cn[0]['aria-valuenow'] = this.aria_valuenow;
+ cfg['aria-valuenow'] = this.aria_valuenow;
+ }
+
+ if(this.aria_valuemin){
+ cfg['aria-valuemin'] = this.aria_valuemin;
+ }
+
+ if(this.aria_valuemax){
+ cfg['aria-valuemax'] = this.aria_valuemax;
}
if(this.label && !this.sr_only){
- cfg.cn[0].html = this.label;
+ cfg.html = this.label;
}
if(this.panel){
- cfg.cn[0].cls += ' progress-bar-' + this.panel;
+ cfg.cls += ' progress-bar-' + this.panel;
}
return cfg;
+ },
+
+ update : function(aria_valuenow)
+ {
+ this.aria_valuenow = aria_valuenow;
+
+ this.el.setStyle('width', Math.ceil((this.aria_valuenow / this.aria_valuemax) * 100) + '%');
}
});