ffe90896be605ceb3d856fc775e120fd513a1a5b
[roojs1] / docs / symbols / src / Roo_bootstrap_NavProgressItem.js.html
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">/*
2  * - LGPL
3  *
4  * Nav Progress Item
5  * 
6  */
7
8 /**
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
15  * 
16  * @constructor
17  * Create a new NavProgressItem
18  * @param {Object} config The config object
19  */
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
24         /**
25          * @event click
26          * The raw click event for the entire grid.
27          * @param {Roo.bootstrap.NavProgressItem} this
28          * @param {Roo.EventObject} e
29          */
30         </span><span class="jsdoc-string">&quot;click&quot; </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">true</span><span class="jsdoc-syntax">,
31          </span><span class="jsdoc-comment">/**
32             * @event changed
33             * Fires when the active item active state changes
34             * @param {Roo.bootstrap.NavProgressItem} this
35             * @param {boolean} state the new state
36              
37          */
38         </span><span class="jsdoc-string">'changed'</span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">true
39     </span><span class="jsdoc-syntax">});
40    
41 };
42
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">,  {
44     
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">,
48     
49     </span><span class="jsdoc-var">getAutoCreate </span><span class="jsdoc-syntax">: </span><span class="jsdoc-keyword">function</span><span class="jsdoc-syntax">()
50     {
51          
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'
55             
56         </span><span class="jsdoc-syntax">}
57         
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">;
60         }
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">;
63         }
64         
65         </span><span class="jsdoc-keyword">return </span><span class="jsdoc-var">cfg</span><span class="jsdoc-syntax">;
66     }
67 </span><span class="jsdoc-comment">//    initEvents: function() 
68 //    {
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));
73 //        }
74 //        
75 //        this.el.select('a',true).on('click', this.onClick, this);
76 //        
77 //        if(this.tagtype == 'span'){
78 //            this.el.select('span',true).on('click', this.onClick, this);
79 //        }
80 //       
81 //        // at this point parent should be available..
82 //        this.parent().register(this);
83 //    },
84 //    
85 //    onClick : function(e)
86 //    {
87 //        if(
88 //                this.preventDefault || 
89 //                this.href == '#' 
90 //        ){
91 //            
92 //            e.preventDefault();
93 //        }
94 //        
95 //        if (this.disabled) {
96 //            return;
97 //        }
98 //        
99 //        var tg = Roo.bootstrap.TabGroup.get(this.navId);
100 //        if (tg &amp;&amp; tg.transition) {
101 //            Roo.log(&quot;waiting for the transitionend&quot;);
102 //            return;
103 //        }
104 //        
105 //        
106 //        
107 //        //Roo.log(&quot;fire event clicked&quot;);
108 //        if(this.fireEvent('click', this, e) === false){
109 //            return;
110 //        };
111 //        
112 //        if(this.tagtype == 'span'){
113 //            return;
114 //        }
115 //        
116 //        //Roo.log(this.href);
117 //        var ael = this.el.select('a',true).first();
118 //        //Roo.log(ael);
119 //        
120 //        if(ael &amp;&amp; this.animateRef &amp;&amp; this.href.indexOf('#') &gt; -1){
121 //            //Roo.log([&quot;test:&quot;,ael.dom.href.split(&quot;#&quot;)[0], document.location.toString().split(&quot;#&quot;)[0]]);
122 //            if (ael.dom.href.split(&quot;#&quot;)[0] != document.location.toString().split(&quot;#&quot;)[0]) {
123 //                return; // ignore... - it's a 'hash' to another page.
124 //            }
125 //            
126 //            e.preventDefault();
127 //            this.scrollToElement(e);
128 //        }
129 //        
130 //        
131 //        var p =  this.parent();
132 //   
133 //        if (['tabs','pills'].indexOf(p.type)!==-1) {
134 //            if (typeof(p.setActiveItem) !== 'undefined') {
135 //                p.setActiveItem(this);
136 //            }
137 //        }
138 //        
139 //        // if parent is a navbarheader....- and link is probably a '#' page ref.. then remove the expanded menu.
140 //        if (p.parentType == 'NavHeaderbar' &amp;&amp; !this.menu) {
141 //            // remove the collapsed menu expand...
142 //            p.parent().el.select('.navbar-collapse',true).removeClass('in');  
143 //        }
144 //    },
145 //    
146 //    isActive: function () {
147 //        return this.active
148 //    },
149 //    setActive : function(state, fire, is_was_active)
150 //    {
151 //        if (this.active &amp;&amp; !state &amp;&amp; this.navId) {
152 //            this.was_active = true;
153 //            var nv = Roo.bootstrap.NavGroup.get(this.navId);
154 //            if (nv) {
155 //                nv.clearWasActive(this);
156 //            }
157 //            
158 //        }
159 //        this.active = state;
160 //        
161 //        if (!state ) {
162 //            this.el.removeClass('active');
163 //        } else if (!this.el.hasClass('active')) {
164 //            this.el.addClass('active');
165 //        }
166 //        if (fire) {
167 //            this.fireEvent('changed', this, state);
168 //        }
169 //        
170 //        // show a panel if it's registered and related..
171 //        
172 //        if (!this.navId || !this.tabId || !state || is_was_active) {
173 //            return;
174 //        }
175 //        
176 //        var tg = Roo.bootstrap.TabGroup.get(this.navId);
177 //        if (!tg) {
178 //            return;
179 //        }
180 //        var pan = tg.getPanelByName(this.tabId);
181 //        if (!pan) {
182 //            return;
183 //        }
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);
187 //            if (nv) {
188 //                var onav = nv.getWasActive();
189 //                if (onav) {
190 //                    onav.setActive(true, false, true);
191 //                }
192 //            }
193 //            
194 //        }
195 //        
196 //        
197 //      
198 //    },
199 //     // this should not be here...
200 //    setDisabled : function(state)
201 //    {
202 //        this.disabled = state;
203 //        if (!state ) {
204 //            this.el.removeClass('disabled');
205 //        } else if (!this.el.hasClass('disabled')) {
206 //            this.el.addClass('disabled');
207 //        }
208 //        
209 //    },
210 //    
211 //    /**
212 //     * Fetch the element to display the tooltip on.
213 //     * @return {Roo.Element} defaults to this.el
214 //     */
215 //    tooltipEl : function()
216 //    {
217 //        return this.el.select('' + this.tagtype + '', true).first();
218 //    },
219 //    
220 //    scrollToElement : function(e)
221 //    {
222 //        var c = document.body;
223 //        
224 //        /*
225 //         * Firefox / IE places the overflow at the html level, unless specifically styled to behave differently.
226 //         */
227 //        if(Roo.isFirefox || Roo.isIE || Roo.isIE11){
228 //            c = document.documentElement;
229 //        }
230 //        
231 //        var target = Roo.get(c).select('a[name=' + this.href.split('#')[1] +']', true).first();
232 //        
233 //        if(!target){
234 //            return;
235 //        }
236 //
237 //        var o = target.calcOffsetsTo(c);
238 //        
239 //        var options = {
240 //            target : target,
241 //            value : o[1]
242 //        }
243 //        
244 //        this.fireEvent('scrollto', this, options, e);
245 //        
246 //        Roo.get(c).scrollTo('top', options.value, true);
247 //        
248 //        return;
249 //    }
250 </span><span class="jsdoc-syntax">});
251  
252
253  </span></code></body></html>