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)
111 // onClick : function(e)
114 // this.preventDefault ||
118 // e.preventDefault();
121 // if (this.disabled) {
125 // var tg = Roo.bootstrap.TabGroup.get(this.navId);
126 // if (tg && tg.transition) {
127 // Roo.log("waiting for the transitionend");
133 // //Roo.log("fire event clicked");
134 // if(this.fireEvent('click', this, e) === false){
138 // if(this.tagtype == 'span'){
142 // //Roo.log(this.href);
143 // var ael = this.el.select('a',true).first();
146 // if(ael && this.animateRef && this.href.indexOf('#') > -1){
147 // //Roo.log(["test:",ael.dom.href.split("#")[0], document.location.toString().split("#")[0]]);
148 // if (ael.dom.href.split("#")[0] != document.location.toString().split("#")[0]) {
149 // return; // ignore... - it's a 'hash' to another page.
152 // e.preventDefault();
153 // this.scrollToElement(e);
157 // var p = this.parent();
159 // if (['tabs','pills'].indexOf(p.type)!==-1) {
160 // if (typeof(p.setActiveItem) !== 'undefined') {
161 // p.setActiveItem(this);
165 // // if parent is a navbarheader....- and link is probably a '#' page ref.. then remove the expanded menu.
166 // if (p.parentType == 'NavHeaderbar' && !this.menu) {
167 // // remove the collapsed menu expand...
168 // p.parent().el.select('.navbar-collapse',true).removeClass('in');
172 // isActive: function () {
173 // return this.active
175 // setActive : function(state, fire, is_was_active)
177 // if (this.active && !state && this.navId) {
178 // this.was_active = true;
179 // var nv = Roo.bootstrap.NavGroup.get(this.navId);
181 // nv.clearWasActive(this);
185 // this.active = state;
188 // this.el.removeClass('active');
189 // } else if (!this.el.hasClass('active')) {
190 // this.el.addClass('active');
193 // this.fireEvent('changed', this, state);
196 // // show a panel if it's registered and related..
198 // if (!this.navId || !this.tabId || !state || is_was_active) {
202 // var tg = Roo.bootstrap.TabGroup.get(this.navId);
206 // var pan = tg.getPanelByName(this.tabId);
210 // // if we can not flip to new panel - go back to old nav highlight..
211 // if (false == tg.showPanel(pan)) {
212 // var nv = Roo.bootstrap.NavGroup.get(this.navId);
214 // var onav = nv.getWasActive();
216 // onav.setActive(true, false, true);
225 // // this should not be here...
226 // setDisabled : function(state)
228 // this.disabled = state;
230 // this.el.removeClass('disabled');
231 // } else if (!this.el.hasClass('disabled')) {
232 // this.el.addClass('disabled');
238 // * Fetch the element to display the tooltip on.
239 // * @return {Roo.Element} defaults to this.el
241 // tooltipEl : function()
243 // return this.el.select('' + this.tagtype + '', true).first();
246 // scrollToElement : function(e)
248 // var c = document.body;
251 // * Firefox / IE places the overflow at the html level, unless specifically styled to behave differently.
253 // if(Roo.isFirefox || Roo.isIE || Roo.isIE11){
254 // c = document.documentElement;
257 // var target = Roo.get(c).select('a[name=' + this.href.split('#')[1] +']', true).first();
263 // var o = target.calcOffsetsTo(c);
270 // this.fireEvent('scrollto', this, options, e);
272 // Roo.get(c).scrollTo('top', options.value, true);