Roo/bootstrap/Pagination.js
[roojs1] / Roo / bootstrap / Pagination.js
1 /*
2  * - LGPL
3  *
4  * column
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.Column
10  * @extends Roo.bootstrap.Component
11  * Bootstrap Column class
12  * @cfg {number} colspan  Number of columsn to span
13  * 
14  * @constructor
15  * Create a new Column
16  * @param {Object} config The config object
17  */
18
19 Roo.bootstrap.Pagination = function(config){
20     Roo.bootstrap.Pagination.superclass.constructor.call(this, config);
21 };
22
23 Roo.extend(Roo.bootstrap.Pagination, Roo.bootstrap.Component,  {
24     
25     html: false,
26     cls: false,
27     size: false,
28     inverse: false,
29     from: 1,
30     to: 4,
31     align: false,
32     active: 1,
33     
34     getAutoCreate : function(){
35         cfg = {
36             tag: 'ul',
37             cls: 'pagination',
38             cn: []
39         }
40         if (this.inverse) {
41             cfg.cls += ' inverse'
42         }
43         if (this.html) {
44             cfg.html=this.html
45         }
46         if (this.cls) {
47             cfg.cls=this.cls
48         }
49         cfg.cn[0]={
50             tag: 'li',
51             cn: [
52                 {
53                     tag: 'a',
54                     href:'#',
55                     html: '«'
56                 }
57             ]
58         }
59         var i=this.from>0?this.from:1;
60         var j=this.to-i<=10?this.to:i+10;
61         for (var i=i;i<j;i++) {
62             cfg.cn.push(
63                 {
64                     tag: 'li',
65                     cn: [
66                         {
67                             tag: 'a',
68                             href: '#',
69                             html: i
70                         }
71                     ]
72                 }
73             )
74         }
75         
76         cfg.cn.push(
77             {
78                 tag: 'li',
79                 cn: [
80                     {
81                        tag: 'a',
82                        href: '#',
83                        html: '&raquo;'
84                     }
85                 ]
86             }
87         )
88         
89         return cfg;
90     }
91    
92 });
93
94  
95
96