9 * @class Roo.bootstrap.NavProgressBar
10 * @extends Roo.bootstrap.Component
11 * Bootstrap NavProgressBar class
14 * Create a new nav progress bar
15 * @param {Object} config The config object
18 Roo.bootstrap.NavProgressBar = function(config){
19 Roo.bootstrap.NavProgressBar.superclass.constructor.call(this, config);
21 this.bullets = this.bullets || [];
23 // Roo.bootstrap.NavProgressBar.register(this);
27 * Fires when the active item changes
28 * @param {Roo.bootstrap.NavProgressBar} this
29 * @param {Roo.bootstrap.NavProgressItem} selected The item selected
30 * @param {Roo.bootstrap.NavProgressItem} prev The previously selected item
37 Roo.extend(Roo.bootstrap.NavProgressBar, Roo.bootstrap.Component, {
43 getAutoCreate : function()
45 var cfg = Roo.apply({}, Roo.bootstrap.NavProgressBar.superclass.getAutoCreate.call(this));
49 cls: 'roo-navigation-bar'
56 onRender : function(ct, position)
58 Roo.bootstrap.NavProgressBar.superclass.onRender.call(this, ct, position);
60 if(this.bullets.length){
61 Roo.each(this.bullets, function(b){
68 addItem : function(cfg)
70 var item = new Roo.bootstrap.NavProgressItem(cfg);
72 item.parentId = this.id;
73 item.render(this.el, null);
75 this.barItems.push(item);
82 getActive : function()
86 Roo.each(this.barItems, function(v){
100 setActiveItem : function(item)
104 Roo.each(this.barItems, function(v){
105 if (v.rid == item.rid) {
115 item.setActive(true);
117 this.fireEvent('changed', this, item, prev);
120 getBarItem: function(rid)
124 Roo.each(this.barItems, function(e) {
136 indexOfItem : function(item)
140 Roo.each(this.barItems, function(v, i){
142 if (v.rid != item.rid) {
153 setActiveNext : function()
155 var i = this.indexOfItem(this.getActive());
157 if (i > this.barItems.length) {
161 this.setActiveItem(this.barItems[i+1]);
164 setActivePrev : function()
166 var i = this.indexOfItem(this.getActive());
172 this.setActiveItem(this.barItems[i-1]);
175 formatBullets : function()
177 if(!this.barItems.length){
181 var width = 100 / this.barItems.length;
183 Roo.each(this.barItems, function(i){
184 i.el.setStyle('width', width + '%');