Fix #6465 - drag drop for cards
[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  * @cfg {Boolean} active (true | false) default false
17  * @cfg {Boolean} disabled default false
18  * 
19  * 
20  * @constructor
21  * Create a new PaginationItem
22  * @param {Object} config The config object
23  */
24
25
26 Roo.bootstrap.PaginationItem = function(config){
27     Roo.bootstrap.PaginationItem.superclass.constructor.call(this, config);
28     this.addEvents({
29         // raw events
30         /**
31          * @event click
32          * The raw click event for the entire grid.
33          * @param {Roo.EventObject} e
34          */
35         "click" : true
36     });
37 };
38
39 Roo.extend(Roo.bootstrap.PaginationItem, Roo.bootstrap.Component,  {
40     
41     href : false,
42     html : false,
43     preventDefault: true,
44     active : false,
45     cls : false,
46     disabled: false,
47     
48     getAutoCreate : function(){
49         var cfg= {
50             tag: 'li',
51             cn: [
52                 {
53                     tag : 'a',
54                     href : this.href ? this.href : '#',
55                     html : this.html ? this.html : ''
56                 }
57             ]
58         };
59         
60         if(this.cls){
61             cfg.cls = this.cls;
62         }
63         
64         if(this.disabled){
65             cfg.cls = typeof(cfg.cls) !== 'undefined' ? cfg.cls + ' disabled' : 'disabled';
66         }
67         
68         if(this.active){
69             cfg.cls = typeof(cfg.cls) !== 'undefined' ? cfg.cls + ' active' : 'active';
70         }
71         
72         return cfg;
73     },
74     
75     initEvents: function() {
76         
77         this.el.on('click', this.onClick, this);
78         
79     },
80     onClick : function(e)
81     {
82         Roo.log('PaginationItem on click ');
83         if(this.preventDefault){
84             e.preventDefault();
85         }
86         
87         if(this.disabled){
88             return;
89         }
90         
91         this.fireEvent('click', this, e);
92     }
93    
94 });
95
96  
97
98