1 <html><head><title>../roojs1/Roo/bootstrap/NavProgressItem.js</title><link rel="stylesheet" type="text/css" href="../../../css/highlight-js.css"/></head><body class="highlightpage"><code class="jsdoc-pretty"><span class="jsdoc-comment">/*
9 * @class Roo.bootstrap.NavProgressItem
10 * @extends Roo.bootstrap.Component
11 * Bootstrap NavProgressItem class
12 * @cfg {String} tabId the tab that this item activates.
13 * @cfg {Boolean} active (true|false) Is item active default false
14 * @cfg {Boolean} disabled (true|false) Is item active default false
17 * Create a new NavProgressItem
18 * @param {Object} config The config object
20 </span><span class="jsdoc-var">Roo.bootstrap.NavProgressItem </span><span class="jsdoc-syntax">= </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">config</span><span class="jsdoc-syntax">){
21 </span><span class="jsdoc-var">Roo.bootstrap.NavProgressItem.superclass.constructor.call</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">config</span><span class="jsdoc-syntax">);
22 </span><span class="jsdoc-var">this.addEvents</span><span class="jsdoc-syntax">({
23 </span><span class="jsdoc-comment">// raw events
26 * The raw click event for the entire grid.
27 * @param {Roo.bootstrap.NavProgressItem} this
28 * @param {Roo.EventObject} e
30 </span><span class="jsdoc-string">"click" </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">true</span><span class="jsdoc-syntax">,
31 </span><span class="jsdoc-comment">/**
33 * Fires when the active item active state changes
34 * @param {Roo.bootstrap.NavProgressItem} this
35 * @param {boolean} state the new state
38 </span><span class="jsdoc-string">'changed'</span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">true
39 </span><span class="jsdoc-syntax">});
43 </span><span class="jsdoc-var">Roo.extend</span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">Roo.bootstrap.NavProgressItem</span><span class="jsdoc-syntax">, </span><span class="jsdoc-var">Roo.bootstrap.Component</span><span class="jsdoc-syntax">, {
45 </span><span class="jsdoc-var">tabId </span><span class="jsdoc-syntax">: </span><span class="jsdoc-string">''</span><span class="jsdoc-syntax">,
46 </span><span class="jsdoc-var">active </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">false</span><span class="jsdoc-syntax">,
47 </span><span class="jsdoc-var">disabled </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">false</span><span class="jsdoc-syntax">,
49 </span><span class="jsdoc-var">getAutoCreate </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">()
52 </span><span class="jsdoc-keyword">var </span><span class="jsdoc-var">cfg </span><span class="jsdoc-syntax">= {
53 </span><span class="jsdoc-var">tag</span><span class="jsdoc-syntax">: </span><span class="jsdoc-string">'li'</span><span class="jsdoc-syntax">,
54 </span><span class="jsdoc-var">cls</span><span class="jsdoc-syntax">: </span><span class="jsdoc-string">'roo-navigation-bar-item'
56 </span><span class="jsdoc-syntax">}
58 </span><span class="jsdoc-keyword">if </span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this.active</span><span class="jsdoc-syntax">) {
59 </span><span class="jsdoc-var">cfg.cls </span><span class="jsdoc-syntax">+= </span><span class="jsdoc-string">' active'</span><span class="jsdoc-syntax">;
61 </span><span class="jsdoc-keyword">if </span><span class="jsdoc-syntax">(</span><span class="jsdoc-var">this.disabled</span><span class="jsdoc-syntax">) {
62 </span><span class="jsdoc-var">cfg.cls </span><span class="jsdoc-syntax">+= </span><span class="jsdoc-string">' disabled'</span><span class="jsdoc-syntax">;
65 </span><span class="jsdoc-keyword">return </span><span class="jsdoc-var">cfg</span><span class="jsdoc-syntax">;
67 </span><span class="jsdoc-comment">// initEvents: function()
69 // if (typeof (this.menu) != 'undefined') {
70 // this.menu.parentType = this.xtype;
71 // this.menu.triggerEl = this.el;
72 // this.menu = this.addxtype(Roo.apply({}, this.menu));
75 // this.el.select('a',true).on('click', this.onClick, this);
77 // if(this.tagtype == 'span'){
78 // this.el.select('span',true).on('click', this.onClick, this);
81 // // at this point parent should be available..
82 // this.parent().register(this);
85 // onClick : function(e)
88 // this.preventDefault ||
92 // e.preventDefault();
95 // if (this.disabled) {
99 // var tg = Roo.bootstrap.TabGroup.get(this.navId);
100 // if (tg && tg.transition) {
101 // Roo.log("waiting for the transitionend");
107 // //Roo.log("fire event clicked");
108 // if(this.fireEvent('click', this, e) === false){
112 // if(this.tagtype == 'span'){
116 // //Roo.log(this.href);
117 // var ael = this.el.select('a',true).first();
120 // if(ael && this.animateRef && this.href.indexOf('#') > -1){
121 // //Roo.log(["test:",ael.dom.href.split("#")[0], document.location.toString().split("#")[0]]);
122 // if (ael.dom.href.split("#")[0] != document.location.toString().split("#")[0]) {
123 // return; // ignore... - it's a 'hash' to another page.
126 // e.preventDefault();
127 // this.scrollToElement(e);
131 // var p = this.parent();
133 // if (['tabs','pills'].indexOf(p.type)!==-1) {
134 // if (typeof(p.setActiveItem) !== 'undefined') {
135 // p.setActiveItem(this);
139 // // if parent is a navbarheader....- and link is probably a '#' page ref.. then remove the expanded menu.
140 // if (p.parentType == 'NavHeaderbar' && !this.menu) {
141 // // remove the collapsed menu expand...
142 // p.parent().el.select('.navbar-collapse',true).removeClass('in');
146 // isActive: function () {
147 // return this.active
149 // setActive : function(state, fire, is_was_active)
151 // if (this.active && !state && this.navId) {
152 // this.was_active = true;
153 // var nv = Roo.bootstrap.NavGroup.get(this.navId);
155 // nv.clearWasActive(this);
159 // this.active = state;
162 // this.el.removeClass('active');
163 // } else if (!this.el.hasClass('active')) {
164 // this.el.addClass('active');
167 // this.fireEvent('changed', this, state);
170 // // show a panel if it's registered and related..
172 // if (!this.navId || !this.tabId || !state || is_was_active) {
176 // var tg = Roo.bootstrap.TabGroup.get(this.navId);
180 // var pan = tg.getPanelByName(this.tabId);
184 // // if we can not flip to new panel - go back to old nav highlight..
185 // if (false == tg.showPanel(pan)) {
186 // var nv = Roo.bootstrap.NavGroup.get(this.navId);
188 // var onav = nv.getWasActive();
190 // onav.setActive(true, false, true);
199 // // this should not be here...
200 // setDisabled : function(state)
202 // this.disabled = state;
204 // this.el.removeClass('disabled');
205 // } else if (!this.el.hasClass('disabled')) {
206 // this.el.addClass('disabled');
212 // * Fetch the element to display the tooltip on.
213 // * @return {Roo.Element} defaults to this.el
215 // tooltipEl : function()
217 // return this.el.select('' + this.tagtype + '', true).first();
220 // scrollToElement : function(e)
222 // var c = document.body;
225 // * Firefox / IE places the overflow at the html level, unless specifically styled to behave differently.
227 // if(Roo.isFirefox || Roo.isIE || Roo.isIE11){
228 // c = document.documentElement;
231 // var target = Roo.get(c).select('a[name=' + this.href.split('#')[1] +']', true).first();
237 // var o = target.calcOffsetsTo(c);
244 // this.fireEvent('scrollto', this, options, e);
246 // Roo.get(c).scrollTo('top', options.value, true);
250 </span><span class="jsdoc-syntax">});
253 </span></code></body></html>