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
38 Roo.extend(Roo.bootstrap.NavProgressItem, Roo.bootstrap.Component, {
47 getAutoCreate : function()
49 var iconCls = 'roo-navigation-bar-item-icon';
51 if((this.forceIcon && this.icon) || !this.forceIcon && Roo.isTouch){
52 iconCls += ' ' + this.icon;
57 cls: 'roo-navigation-bar-item',
65 cls : 'roo-navigation-bar-item-text ' + this.position,
75 cfg.cls += ' disabled';
81 initEvents: function()
83 this.iconEl = this.el.select('.roo-navigation-bar-item-icon', true).first();
84 this.textEl = this.el.select('.roo-navigation-bar-item-text', true).first();
87 this.textEl.setVisibilityMode(Roo.Element.DISPLAY).hide();
90 this.iconEl.on('click', this.onClick, this);
102 Roo.log(this.parent());
106 this.fireEvent('click', this, e);
109 isActive: function ()
114 setActive : function(state)
116 if(this.active == state){
122 if (this.el.hasClass('active')) {
123 this.el.removeClass('active');
127 this.el.addClass('active');
130 // show a panel if it's registered and related..
132 if (!this.navId || !this.tabId || !state || is_was_active) {
136 var tg = Roo.bootstrap.TabGroup.get(this.navId);
140 var pan = tg.getPanelByName(this.tabId);
144 // if we can not flip to new panel - go back to old nav highlight..
145 if (false == tg.showPanel(pan)) {
146 var nv = Roo.bootstrap.NavGroup.get(this.navId);
148 var onav = nv.getWasActive();
150 onav.setActive(true, false, true);
163 // onClick : function(e)
166 // this.preventDefault ||
170 // e.preventDefault();
173 // if (this.disabled) {
177 // var tg = Roo.bootstrap.TabGroup.get(this.navId);
178 // if (tg && tg.transition) {
179 // Roo.log("waiting for the transitionend");
185 // //Roo.log("fire event clicked");
186 // if(this.fireEvent('click', this, e) === false){
190 // if(this.tagtype == 'span'){
194 // //Roo.log(this.href);
195 // var ael = this.el.select('a',true).first();
198 // if(ael && this.animateRef && this.href.indexOf('#') > -1){
199 // //Roo.log(["test:",ael.dom.href.split("#")[0], document.location.toString().split("#")[0]]);
200 // if (ael.dom.href.split("#")[0] != document.location.toString().split("#")[0]) {
201 // return; // ignore... - it's a 'hash' to another page.
204 // e.preventDefault();
205 // this.scrollToElement(e);
209 // var p = this.parent();
211 // if (['tabs','pills'].indexOf(p.type)!==-1) {
212 // if (typeof(p.setActiveItem) !== 'undefined') {
213 // p.setActiveItem(this);
217 // // if parent is a navbarheader....- and link is probably a '#' page ref.. then remove the expanded menu.
218 // if (p.parentType == 'NavHeaderbar' && !this.menu) {
219 // // remove the collapsed menu expand...
220 // p.parent().el.select('.navbar-collapse',true).removeClass('in');
224 // isActive: function () {
225 // return this.active
227 // setActive : function(state, fire, is_was_active)
229 // if (this.active && !state && this.navId) {
230 // this.was_active = true;
231 // var nv = Roo.bootstrap.NavGroup.get(this.navId);
233 // nv.clearWasActive(this);
237 // this.active = state;
240 // this.el.removeClass('active');
241 // } else if (!this.el.hasClass('active')) {
242 // this.el.addClass('active');
245 // this.fireEvent('changed', this, state);
248 // // show a panel if it's registered and related..
250 // if (!this.navId || !this.tabId || !state || is_was_active) {
254 // var tg = Roo.bootstrap.TabGroup.get(this.navId);
258 // var pan = tg.getPanelByName(this.tabId);
262 // // if we can not flip to new panel - go back to old nav highlight..
263 // if (false == tg.showPanel(pan)) {
264 // var nv = Roo.bootstrap.NavGroup.get(this.navId);
266 // var onav = nv.getWasActive();
268 // onav.setActive(true, false, true);
277 // // this should not be here...
278 // setDisabled : function(state)
280 // this.disabled = state;
282 // this.el.removeClass('disabled');
283 // } else if (!this.el.hasClass('disabled')) {
284 // this.el.addClass('disabled');
290 // * Fetch the element to display the tooltip on.
291 // * @return {Roo.Element} defaults to this.el
293 // tooltipEl : function()
295 // return this.el.select('' + this.tagtype + '', true).first();
298 // scrollToElement : function(e)
300 // var c = document.body;
303 // * Firefox / IE places the overflow at the html level, unless specifically styled to behave differently.
305 // if(Roo.isFirefox || Roo.isIE || Roo.isIE11){
306 // c = document.documentElement;
309 // var target = Roo.get(c).select('a[name=' + this.href.split('#')[1] +']', true).first();
315 // var o = target.calcOffsetsTo(c);
322 // this.fireEvent('scrollto', this, options, e);
324 // Roo.get(c).scrollTo('top', options.value, true);