9 * @class Roo.bootstrap.NavProgressItem
10 * @extends Roo.bootstrap.Component
11 * Bootstrap NavProgressItem class
12 * @cfg {String} rid the reference id
13 * @cfg {Boolean} active (true|false) Is item active default false
14 * @cfg {Boolean} disabled (true|false) Is item active default false
16 * @cfg {String} position (top|bottom) text position default bottom
17 * @cfg {String} icon show icon instead of number
18 * @cfg {Boolean} forceIcon (true|false) true to force show icon..if set to false, Roo.isTouch showing icon, otherwish number
21 * Create a new NavProgressItem
22 * @param {Object} config The config object
24 Roo.bootstrap.NavProgressItem = function(config){
25 Roo.bootstrap.NavProgressItem.superclass.constructor.call(this, config);
30 * The raw click event for the entire grid.
31 * @param {Roo.bootstrap.NavProgressItem} this
32 * @param {Roo.EventObject} e
39 Roo.extend(Roo.bootstrap.NavProgressItem, Roo.bootstrap.Component, {
49 getAutoCreate : function()
51 var iconCls = 'roo-navigation-bar-item-icon';
53 if((this.forceIcon && this.icon) || !this.forceIcon && Roo.isTouch){
54 iconCls += ' ' + this.icon;
59 cls: 'roo-navigation-bar-item',
67 cls : 'roo-navigation-bar-item-text ' + this.position,
77 cfg.cls += ' disabled';
83 render : function(container, position){
84 if(!this.rendered && this.fireEvent("beforerender", this) !== false){
85 if(!container && this.el){
86 this.el = Roo.get(this.el);
87 container = this.el.dom.parentNode;
88 this.allowDomMove = false;
90 this.container = Roo.get(container);
92 if(position !== undefined){
93 if(typeof position == 'number'){
94 position = this.container.dom.childNodes[position];
96 position = Roo.getDom(position);
99 this.onRender(container, position || null);
102 this.el.applyStyles(this.style);
105 this.fireEvent("render", this);
106 this.afterRender(this.container);
117 initEvents: function()
119 this.iconEl = this.el.select('.roo-navigation-bar-item-icon', true).first();
120 this.textEl = this.el.select('.roo-navigation-bar-item-text', true).first();
123 this.textEl.setVisibilityMode(Roo.Element.DISPLAY).hide();
126 this.iconEl.on('click', this.onClick, this);
130 onClick : function(e)
138 if(this.fireEvent('click', this, e) === false){
142 this.parent().setActiveItem(this);
145 isActive: function ()
150 setActive : function(state)
152 if(this.active == state){
159 this.el.addClass('active');
163 this.el.removeClass('active');
168 setDisabled : function(state)
170 if(this.disabled == state){
174 this.disabled = state;
177 this.el.addClass('disabled');
181 this.el.removeClass('disabled');
184 tooltipEl : function()
186 return this.el.select('.roo-navigation-bar-item-icon', true).first();;