source:
trunk/workshop-routing-foss4g/web/ext/src/widgets/grid/RowNumberer.js
@
81
Revision 76, 1.7 KB checked in by djay, 13 years ago (diff) | |
---|---|
|
Rev | Line | |
---|---|---|
[76] | 1 | /*! |
2 | * Ext JS Library 3.4.0 | |
3 | * Copyright(c) 2006-2011 Sencha Inc. | |
4 | * licensing@sencha.com | |
5 | * http://www.sencha.com/license | |
6 | */ | |
7 | /** | |
8 | * @class Ext.grid.RowNumberer | |
9 | * This is a utility class that can be passed into a {@link Ext.grid.ColumnModel} as a column config that provides | |
10 | * an automatic row numbering column. | |
11 | * <br>Usage:<br> | |
12 | <pre><code> | |
13 | // This is a typical column config with the first column providing row numbers | |
14 | var colModel = new Ext.grid.ColumnModel([ | |
15 | new Ext.grid.RowNumberer(), | |
16 | {header: "Name", width: 80, sortable: true}, | |
17 | {header: "Code", width: 50, sortable: true}, | |
18 | {header: "Description", width: 200, sortable: true} | |
19 | ]); | |
20 | </code></pre> | |
21 | * @constructor | |
22 | * @param {Object} config The configuration options | |
23 | */ | |
24 | Ext.grid.RowNumberer = Ext.extend(Object, { | |
25 | /** | |
26 | * @cfg {String} header Any valid text or HTML fragment to display in the header cell for the row | |
27 | * number column (defaults to ''). | |
28 | */ | |
29 | header: "", | |
30 | /** | |
31 | * @cfg {Number} width The default width in pixels of the row number column (defaults to 23). | |
32 | */ | |
33 | width: 23, | |
34 | /** | |
35 | * @cfg {Boolean} sortable True if the row number column is sortable (defaults to false). | |
36 | * @hide | |
37 | */ | |
38 | sortable: false, | |
39 | ||
40 | constructor : function(config){ | |
41 | Ext.apply(this, config); | |
42 | if(this.rowspan){ | |
43 | this.renderer = this.renderer.createDelegate(this); | |
44 | } | |
45 | }, | |
46 | ||
47 | // private | |
48 | fixed:true, | |
49 | hideable: false, | |
50 | menuDisabled:true, | |
51 | dataIndex: '', | |
52 | id: 'numberer', | |
53 | rowspan: undefined, | |
54 | ||
55 | // private | |
56 | renderer : function(v, p, record, rowIndex){ | |
57 | if(this.rowspan){ | |
58 | p.cellAttr = 'rowspan="'+this.rowspan+'"'; | |
59 | } | |
60 | return rowIndex+1; | |
61 | } | |
62 | }); |
Note: See TracBrowser
for help on using the repository browser.