Roo/bootstrap/PaginationItem.js
[roojs1] / Roo / bootstrap / PaginationItem.js
1 /*
2  * - LGPL
3  *
4  * Pagination item
5  * 
6  */
7
8
9 /**
10  * @class Roo.bootstrap.PaginationItem
11  * @extends Roo.bootstrap.Component
12  * Bootstrap PaginationItem class
13  * @cfg {String} html text
14  * @cfg {String} href the link
15  * @cfg {Boolean} preventDefault (true | false) default true
16  * 
17  * 
18  * @constructor
19  * Create a new PaginationItem
20  * @param {Object} config The config object
21  */
22
23
24 Roo.bootstrap.PaginationItem = function(config){
25     Roo.bootstrap.PaginationItem.superclass.constructor.call(this, config);
26     this.addEvents({
27         // raw events
28         /**
29          * @event click
30          * The raw click event for the entire grid.
31          * @param {Roo.EventObject} e
32          */
33         "click" : true
34     });
35 };
36
37 Roo.extend(Roo.bootstrap.PaginationItem, Roo.bootstrap.Component,  {
38     
39     href : false,
40     html : false,
41     preventDefault: true,
42     
43     getAutoCreate : function(){
44         var cfg= {
45             tag: 'li',
46             cn: [
47                 {
48                     tag : 'a',
49                     href : this.href ? this.href : '#',
50                     html : this.html ? this.html : ''
51                 }
52             ]
53         };
54         
55         return cfg;
56     },
57     
58     initEvents: function() {
59         
60         this.el.on('click', this.onClick, this);
61         
62     },
63     onClick : function(e)
64     {
65         Roo.log('PaginationItem on click ');
66         if(this.preventDefault){
67             e.preventDefault();
68         }
69         
70         this.fireEvent('click', this, e);
71     }
72    
73 });
74
75  
76
77