9 * @class Roo.bootstrap.NavProgressItem
10 * @extends Roo.bootstrap.Component
11 * Bootstrap NavProgressItem class
12 * @cfg {Boolean} active (true|false) Is item active default false
13 * @cfg {Boolean} disabled (true|false) Is item active default false
15 * @cfg {String} position (top|bottom) text position default bottom
16 * @cfg {String} icon show icon instead of number
17 * @cfg {Boolean} forceIcon (true|false) true to force show icon..if set to false, Roo.isTouch showing icon, otherwish number
20 * Create a new NavProgressItem
21 * @param {Object} config The config object
23 Roo.bootstrap.NavProgressItem = function(config){
24 Roo.bootstrap.NavProgressItem.superclass.constructor.call(this, config);
29 * The raw click event for the entire grid.
30 * @param {Roo.bootstrap.NavProgressItem} this
31 * @param {Roo.EventObject} e
36 * Fires when the active item active state changes
37 * @param {Roo.bootstrap.NavProgressItem} this
38 * @param {boolean} state the new state
46 Roo.extend(Roo.bootstrap.NavProgressItem, Roo.bootstrap.Component, {
55 getAutoCreate : function()
57 var iconCls = 'roo-navigation-bar-item-icon';
59 if((this.forceIcon && this.icon) || !this.forceIcon && Roo.isTouch){
60 iconCls += ' ' + this.icon;
65 cls: 'roo-navigation-bar-item',
73 cls : 'roo-navigation-bar-item-text ' + this.position,
83 cfg.cls += ' disabled';
89 initEvents: function()
91 this.iconEl = this.el.select('.roo-navigation-bar-item-icon', true).first();
92 this.textEl = this.el.select('.roo-navigation-bar-item-text', true).first();
95 this.textEl.setVisibilityMode(Roo.Element.DISPLAY).hide();
98 this.iconEl.on('click', this.onClick, this);
102 onClick : function(e)
110 this.fireEvent('click', this, e);
117 // onClick : function(e)
120 // this.preventDefault ||
124 // e.preventDefault();
127 // if (this.disabled) {
131 // var tg = Roo.bootstrap.TabGroup.get(this.navId);
132 // if (tg && tg.transition) {
133 // Roo.log("waiting for the transitionend");
139 // //Roo.log("fire event clicked");
140 // if(this.fireEvent('click', this, e) === false){
144 // if(this.tagtype == 'span'){
148 // //Roo.log(this.href);
149 // var ael = this.el.select('a',true).first();
152 // if(ael && this.animateRef && this.href.indexOf('#') > -1){
153 // //Roo.log(["test:",ael.dom.href.split("#")[0], document.location.toString().split("#")[0]]);
154 // if (ael.dom.href.split("#")[0] != document.location.toString().split("#")[0]) {
155 // return; // ignore... - it's a 'hash' to another page.
158 // e.preventDefault();
159 // this.scrollToElement(e);
163 // var p = this.parent();
165 // if (['tabs','pills'].indexOf(p.type)!==-1) {
166 // if (typeof(p.setActiveItem) !== 'undefined') {
167 // p.setActiveItem(this);
171 // // if parent is a navbarheader....- and link is probably a '#' page ref.. then remove the expanded menu.
172 // if (p.parentType == 'NavHeaderbar' && !this.menu) {
173 // // remove the collapsed menu expand...
174 // p.parent().el.select('.navbar-collapse',true).removeClass('in');
178 // isActive: function () {
179 // return this.active
181 // setActive : function(state, fire, is_was_active)
183 // if (this.active && !state && this.navId) {
184 // this.was_active = true;
185 // var nv = Roo.bootstrap.NavGroup.get(this.navId);
187 // nv.clearWasActive(this);
191 // this.active = state;
194 // this.el.removeClass('active');
195 // } else if (!this.el.hasClass('active')) {
196 // this.el.addClass('active');
199 // this.fireEvent('changed', this, state);
202 // // show a panel if it's registered and related..
204 // if (!this.navId || !this.tabId || !state || is_was_active) {
208 // var tg = Roo.bootstrap.TabGroup.get(this.navId);
212 // var pan = tg.getPanelByName(this.tabId);
216 // // if we can not flip to new panel - go back to old nav highlight..
217 // if (false == tg.showPanel(pan)) {
218 // var nv = Roo.bootstrap.NavGroup.get(this.navId);
220 // var onav = nv.getWasActive();
222 // onav.setActive(true, false, true);
231 // // this should not be here...
232 // setDisabled : function(state)
234 // this.disabled = state;
236 // this.el.removeClass('disabled');
237 // } else if (!this.el.hasClass('disabled')) {
238 // this.el.addClass('disabled');
244 // * Fetch the element to display the tooltip on.
245 // * @return {Roo.Element} defaults to this.el
247 // tooltipEl : function()
249 // return this.el.select('' + this.tagtype + '', true).first();
252 // scrollToElement : function(e)
254 // var c = document.body;
257 // * Firefox / IE places the overflow at the html level, unless specifically styled to behave differently.
259 // if(Roo.isFirefox || Roo.isIE || Roo.isIE11){
260 // c = document.documentElement;
263 // var target = Roo.get(c).select('a[name=' + this.href.split('#')[1] +']', true).first();
269 // var o = target.calcOffsetsTo(c);
276 // this.fireEvent('scrollto', this, options, e);
278 // Roo.get(c).scrollTo('top', options.value, true);