RowNumberer_wev8.js
1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* Ext JS Library 2.0.2
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
/**
* @class Ext.grid.RowNumberer
* This is a utility class that can be passed into a {@link Ext.grid.ColumnModel} as a column config that provides
* an automatic row numbering column.
* <br>Usage:<br>
<pre><code>
// This is a typical column config with the first column providing row numbers
var colModel = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{header: "Name", width: 80, sortable: true},
{header: "Code", width: 50, sortable: true},
{header: "Description", width: 200, sortable: true}
]);
</code></pre>
* @constructor
* @param {Object} config The configuration options
*/
Ext.grid.RowNumberer = function(config){
Ext.apply(this, config);
if(this.rowspan){
this.renderer = this.renderer.createDelegate(this);
}
};
Ext.grid.RowNumberer.prototype = {
/**
* @cfg {String} header Any valid text or HTML fragment to display in the header cell for the row
* number column (defaults to '').
*/
header: "",
/**
* @cfg {Number} width The default width in pixels of the row number column (defaults to 23).
*/
width: 23,
/**
* @cfg {Boolean} sortable True if the row number column is sortable (defaults to false).
*/
sortable: false,
// private
fixed:true,
menuDisabled:true,
dataIndex: '',
id: 'numberer',
rowspan: undefined,
// private
renderer : function(v, p, record, rowIndex){
if(this.rowspan){
p.cellAttr = 'rowspan="'+this.rowspan+'"';
}
return rowIndex+1;
}
};