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 initEvents: function()
85 this.iconEl = this.el.select('.roo-navigation-bar-item-icon', true).first();
86 this.textEl = this.el.select('.roo-navigation-bar-item-text', true).first();
89 this.textEl.setVisibilityMode(Roo.Element.DISPLAY).hide();
92 this.iconEl.on('click', this.onClick, this);
104 if(this.fireEvent('click', this, e) === false){
108 this.parent().setActiveItem(this);
112 isActive: function ()
117 setActive : function(state)
119 if(this.active == state){
125 if (this.el.hasClass('active')) {
126 this.el.removeClass('active');
130 this.el.addClass('active');
138 this.disabled = true;
140 this.el.addClass('disabled');
147 // onClick : function(e)
150 // this.preventDefault ||
154 // e.preventDefault();
157 // if (this.disabled) {
161 // var tg = Roo.bootstrap.TabGroup.get(this.navId);
162 // if (tg && tg.transition) {
163 // Roo.log("waiting for the transitionend");
169 // //Roo.log("fire event clicked");
170 // if(this.fireEvent('click', this, e) === false){
174 // if(this.tagtype == 'span'){
178 // //Roo.log(this.href);
179 // var ael = this.el.select('a',true).first();
182 // if(ael && this.animateRef && this.href.indexOf('#') > -1){
183 // //Roo.log(["test:",ael.dom.href.split("#")[0], document.location.toString().split("#")[0]]);
184 // if (ael.dom.href.split("#")[0] != document.location.toString().split("#")[0]) {
185 // return; // ignore... - it's a 'hash' to another page.
188 // e.preventDefault();
189 // this.scrollToElement(e);
193 // var p = this.parent();
195 // if (['tabs','pills'].indexOf(p.type)!==-1) {
196 // if (typeof(p.setActiveItem) !== 'undefined') {
197 // p.setActiveItem(this);
201 // // if parent is a navbarheader....- and link is probably a '#' page ref.. then remove the expanded menu.
202 // if (p.parentType == 'NavHeaderbar' && !this.menu) {
203 // // remove the collapsed menu expand...
204 // p.parent().el.select('.navbar-collapse',true).removeClass('in');
208 // isActive: function () {
209 // return this.active
211 // setActive : function(state, fire, is_was_active)
213 // if (this.active && !state && this.navId) {
214 // this.was_active = true;
215 // var nv = Roo.bootstrap.NavGroup.get(this.navId);
217 // nv.clearWasActive(this);
221 // this.active = state;
224 // this.el.removeClass('active');
225 // } else if (!this.el.hasClass('active')) {
226 // this.el.addClass('active');
229 // this.fireEvent('changed', this, state);
232 // // show a panel if it's registered and related..
234 // if (!this.navId || !this.tabId || !state || is_was_active) {
238 // var tg = Roo.bootstrap.TabGroup.get(this.navId);
242 // var pan = tg.getPanelByName(this.tabId);
246 // // if we can not flip to new panel - go back to old nav highlight..
247 // if (false == tg.showPanel(pan)) {
248 // var nv = Roo.bootstrap.NavGroup.get(this.navId);
250 // var onav = nv.getWasActive();
252 // onav.setActive(true, false, true);
261 // // this should not be here...
262 // setDisabled : function(state)
264 // this.disabled = state;
266 // this.el.removeClass('disabled');
267 // } else if (!this.el.hasClass('disabled')) {
268 // this.el.addClass('disabled');
274 // * Fetch the element to display the tooltip on.
275 // * @return {Roo.Element} defaults to this.el
277 // tooltipEl : function()
279 // return this.el.select('' + this.tagtype + '', true).first();
282 // scrollToElement : function(e)
284 // var c = document.body;
287 // * Firefox / IE places the overflow at the html level, unless specifically styled to behave differently.
289 // if(Roo.isFirefox || Roo.isIE || Roo.isIE11){
290 // c = document.documentElement;
293 // var target = Roo.get(c).select('a[name=' + this.href.split('#')[1] +']', true).first();
299 // var o = target.calcOffsetsTo(c);
306 // this.fireEvent('scrollto', this, options, e);
308 // Roo.get(c).scrollTo('top', options.value, true);