major doc changes
[roojs1] / Roo / bootstrap / breadcrumb / Item.js
1 /*
2  * - LGPL
3  *
4  *  Breadcrumb Item
5  * 
6  */
7
8
9 /**
10  * @class Roo.bootstrap.breadcrumb.Nav
11  * @extends Roo.bootstrap.Component
12  * @children Roo.bootstrap.Component
13  * @parent Roo.bootstrap.breadcrumb.Nav
14  * Bootstrap Breadcrumb Nav Class
15  *  
16  * 
17  * @cfg {String} html the content of the link.
18  * @cfg {String} href where it links to if '#' is used the link will be handled by onClick.
19  * @cfg {Boolean} active is it active
20
21  * 
22  * @constructor
23  * Create a new breadcrumb.Nav
24  * @param {Object} config The config object
25  */
26
27 Roo.bootstrap.breadcrumb.Item = function(config){
28     Roo.bootstrap.breadcrumb.Item.superclass.constructor.call(this, config);
29     this.addEvents({
30         // img events
31         /**
32          * @event click
33          * The img click event for the img.
34          * @param {Roo.EventObject} e
35          */
36         "click" : true
37     });
38     
39 };
40
41 Roo.extend(Roo.bootstrap.breadcrumb.Item, Roo.bootstrap.Component,  {
42     
43     href: false,
44     html : '',
45     
46     getAutoCreate : function()
47     {
48
49         var cfg = {
50             tag: 'li',
51             cls : 'breadcrumb-item' + (this.active ? ' active' : '')
52         };
53         if (this.href !== false) {
54             cfg.cn = [{
55                 tag : 'a',
56                 href : this.href,
57                 html : this.html
58             }];
59         } else {
60             cfg.html = this.html;
61         }
62         
63         return cfg;
64     },
65     
66     initEvents: function()
67     {
68         if (this.href) {
69             this.el.select('a', true).first().on('click',this.onClick, this)
70         }
71         
72     },
73     onClick : function(e)
74     {
75         e.preventDefault();
76         this.fireEvent('click',this,  e);
77     }
78     
79 });
80
81